🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17080

Re: Another Issue about ShellExecute

#17080
From: Jo�o Pereira
Date: Tue, 08 Apr 2003 17:57
104 lines
3896 bytes
Thx again!
But i got this error message:
[C++ Error] Unit1.cpp(64): E2034 Cannot convert 'int (__stdcall *)(void
*,long)' to 'int (__stdcall *)()'
[C++ Error] Unit1.cpp(64): E2342 Type mismatch in parameter 'lpEnumFunc'
(wanted 'int (__stdcall *)()', got 'int (__stdcall *)(void *,long)')
on
EnumWindows(MyEnumProc, (LPARAM) pi.dwProcessId);

could you solve it?
And how i'll put this code in my project instead of a Console Wizard.
Thanx very much for the help






"Ed Mulroy [TeamB]" <ed@mulroyREMOVETHESECHARS.org> wrote in message
news:3e93038d@newsgroups.borland.com...
> > Jo�o Pereira wrote in message
> > news:3e92ee2f@newsgroups.borland.com...
> >
> > but could you make a example explaining how do you
> > can move and positionate a window, with
> > CreateProcess(), EnumWindows() and
> > GetWindowThreadProcessId().
>
> Exactly the same functionality as someone asked me for the other day.
>
> Create a text file named "TEST.TXT" in the project directory and then
> compile and run this.  It's an API-only program so if you build it from
> within the IDE then use the console wizard with the GUI checkbox checked
and
> the VCL one not checked.
>
> -----------------------
> #include <windows.h>
>
> HWND child_hwnd;
>
> BOOL CALLBACK MyEnumProc(HWND hwnd, LPARAM lp)
>   {
>   DWORD hwnd_pid;
>
>   // get process id for the window
>   GetWindowThreadProcessId(hwnd, &hwnd_pid);
>
>   // if they match, save the value, end the enumeration
>   if (hwnd_pid == (DWORD) lp)
>     {
>     child_hwnd = hwnd;
>     return FALSE;
>     }
>
>   return TRUE;
>   }
>
> // move the window down and to the left 2 pixels
> // then wait 10 millisec
> void MoveDelay()
>   {
>   RECT r;
>
>   GetWindowRect(child_hwnd, &r);
>   MoveWindow(child_hwnd, r.left + 2, r.top + 2,
>              r.right - r.left, r.bottom - r.top, TRUE);
>   Sleep(10);
>   }
>
> int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
>   {
>   STARTUPINFO         starti;
>   PROCESS_INFORMATION pi;
>
>   // start notepad with the text file as a cmd line argument
>   ZeroMemory(&starti, sizeof(starti));
>   starti.cb = sizeof(starti);
>   CreateProcess(NULL, "notepad.exe test.txt",
>           NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS,
>           NULL, NULL, &starti, &pi);
>
>   // wait until notepad has initialized
>   WaitForInputIdle(pi.hProcess, 4000U);
>
>   // find the notepad window handle
>   EnumWindows(MyEnumProc, (LPARAM) pi.dwProcessId);
>
>   // if found, then move it
>   if (child_hwnd)
>     {
>     for (int i = 0; i < 100; ++i)
>       {
>       MoveDelay();
>       }
>     }
>
>   return 0;
>   }
> -----------------------
>
> .  Ed
>
>
Technical Details
Message-ID: <3e930d9c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e8c0ea4@newsgroups.borland.com> <3e918b4d@newsgroups.borland.com> <3e91b8e8$1@newsgroups.borland.com> <3e91be11$1@newsgroups.borland.com> <3e91c5c6$1@newsgroups.borland.com> <3e92ee2f@newsgroups.borland.com> <3e93038d@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,bff1fa0e8e8777f2
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-08 11:03:31 PST
From: "Jo�o Pereira" <joao@pupula.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e8c0ea4@newsgroups.borland.com> <3e918b4d@newsgroups.borland.com> <3e91b8e8$1@newsgroups.borland.com> <3e91be11$1@newsgroups.borland.com> <3e91c5c6$1@newsgroups.borland.com> <3e92ee2f@newsgroups.borland.com> <3e93038d@newsgroups.borland.com>
Subject: Re: Another Issue about ShellExecute
Date: Tue, 8 Apr 2003 18:57:41 +0100
Lines: 106
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 213.146.200.120
Message-ID: <3e930d9c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049824668 213.146.200.120 (8 Apr 2003 10:57:48 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail