ToolWindow with asm...

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

OK here now my very first little steps with asm.

Wavemaker presented the PopUpWindow Library with asm code (excellent for learning!)
and I changed:

Code: Select all

sc CreateWindowExA,WS_EX_CONTROLPARENT|WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME,Class1,[textpointer],WS_POPUPWINDOW|WS_DLGFRAME|WS_CLIPSIBLINGS|WS_VISIBLE|DS_MODALFRAME|DS_3DLOOK,[xxx],[yyy],[width],[height],[_PB_Window_Current],0,[_PB_Instance],0
to

Code: Select all

sc CreateWindowExA,WS_EX_TOOLWINDOW,Class1,[textpointer],WS_POPUPWINDOW|WS_DLGFRAME|WS_CLIPSIBLINGS|WS_VISIBLE|DS_MODALFRAME|DS_3DLOOK,[xxx],[yyy],[width],[height],[_PB_Window_Current],0,[_PB_Instance],0
wanted to have a tool window without a button in the application tray and a small title bar.

Also added this before:

Code: Select all

WS_EX_TOOLWINDOW equ 128
and changed the command name to OpenToolWindow. (also in the desc file)

After nasm and libmaker I have a library without errors.

Now when using the OpenToolWindow command I get a nice ToolWindow without a button in the application tray - but something is wrong, because this program is not responding.
Why?
Also tryed to change the flags for the window (in the asm file) but it's always the same.
Can anybody help me to understand what is wrong?



Have a nice day...
Franco


Edited by - franco on 28 November 2001 00:40:07
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

BTW
There are programs they have normal windows (not a tool window) and have no buttons in the application bar or are unvisible in the task viewer (pressing ctrl-alt-del).
How can this be done with pb?



Have a nice day...
Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by wavemaker.

Franco, I tested your changes with my library and the example pb file and it worked perfectly, tool window was created and it didn't conflict with nothing else (give it a 3 id and let the pop up windows show, there's no problem). Send me your asm and desc code so I can figure out the problem.

Before you get mad with the source check that the function name is the proper in Asm and Desc files, and that you don't get a "Can't open main obj" or something like that with LibraryMaker. When testing your changes all I did was add the equ, copy the OpenPopUpWindow function to other named OpenToolWindow (and 'GLOBAL' it at the begining of the code), change the flags in CreateWindowsExA, and copy the function with its name in the Desc file. Everything worked fine.

About the hidden matter, here's what I got from Internet, have no time to comment it (just translated it from Masm to Nasm syntax):

Code: Select all

; Hidden, coded by CybOrgAsm, Porto Alegre - Brasil. 05/1999
; Suggestions, comments ? -> Contact me at [url]mailto:hardlock@cyberspace.org[/url]
; Well.. I've seen many ppl asking about "how to hide a process from
; the control+alt+del box", so here is a simple example on how to do it.
;
; Thank you Iczelion for the Win32Asm homepage.


Extern _GetModuleHandleA@4
Extern _GetProcAddress@8
Extern _MessageBoxA@16
Extern _ExitProcess@4


MB_OK equ 0


[section .data]


%macro sc 1+
  sc2 _%1
%endmacro
%macro sc2 1-*
  %assign %%i (%0-1)*4
  %rep %0 -1
    %rotate -1
    push  dword %1
  %endrep
  %rotate -1
        call  %1@%%i
%endmacro


SEGMENT .text USE32 CLASS=CODE


..start:
  sc GetModuleHandleA, kernel32     ; get module handle of kernel32.dll
  or eax, eax			    ; you must LoadLibrary if your program
  jz .sair                          ; doesn't call any function in kernel32.dll
  sc GetProcAddress, eax, func      ; we must get the address
                                    ; of undocumented function
  or eax, eax
  jz .sair
  mov [RSP], eax                    ; save the address
  push dword 1                      ; hide
  push dword 0                      ; 0 = this process
  call [RSP]                        ; call it
  sc MessageBoxA, 0, mens1, mcaption, MB_OK
  push dword 0                      ; well.. we don't have a function called
                                    ; "UnRegisterServiceProcess" BUT...
                                    ; if you put a 0 , you will "unhide" it >:)
  push dword 0                      ; this process. (but what about unhide others?)
  call [RSP]                        ; call it
  sc MessageBoxA, 0, mens2, mcaption, MB_OK
.sair:
  sc ExitProcess, 0                 ; cya!
  ret                               ; I guess you put a ret here, don't you? (Wavemaker dixit)


[section .data]


mens1    db     "This process was hidden of control+alt+del box!", 0
mens2    db     "Now, you can see it...", 0
mcaption db     "Program: Hidden Process... by CybOrgAsm, POA - Brasil", 0
kernel32 db     "kernel32.dll", 0
func     db     "RegisterServiceProcess", 0             ; undocumented.


[section .bss]


RSP	 resd	1

Regards,

Wavemaker


Edited by - wavemaker on 28 November 2001 03:20:08
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Thanks Wavemaker.
You have right - if your example code is used all works fine.
But the toolwindow is a child window.
My intension was that the parent window has a toolwindow look.
I have code in BCX-Basic and it works well. hum...
Anyway thanks for your help.



Have a nice day...
Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by wavemaker.

All you have to do is use 0 as parent window handle, and it'll work:

sc CreateWindowExA,WS_EX_TOOLWINDOW,Class1,[textpointer],WS_DLGFRAME|WS_CLIPSIBLINGS|WS_VISIBLE|DS_MODALFRAME|DS_3DLOOK,[xxx],[yyy],[width],[height],0,0,[_PB_Instance],0

Bye,



Juan Calderón Alonso
Registered user

Edited by - wavemaker on 28 November 2001 21:02:18
Post Reply