|
UINT WINAPI WinExec(
LPCSTR lpCmdLine,
UINT uCmdShow
);
Where uCmdShow can be any of the following:
SW_FORCEMINIMIZE
Windows 2000/XP: Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread.
SW_HIDE
Hides the window and activates another window.
SW_MAXIMIZE
Maximizes the specified window.
SW_MINIMIZE
Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE
Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW
Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT
Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
SW_SHOWMAXIMIZED
Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED
Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE
Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED , except the window is not activated.
SW_SHOWNA
Displays the window in its current size and position. This value is similar to SW_SHOW, except the window is not activated.
SW_SHOWNOACTIVATE
Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except the window is not actived.
SW_SHOWNORMAL
Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
Only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
hi, experts, my project on solving the machine cell formation problem using genetic algorithm has encounter problems, the requirment for this project is to arrange the machines into different cells that can get the optimize timing and most efficiency, i don't know how to use the C++ to solve this problem, can anyone give me a hand!!!, this is my FYP, if i can't do it, i can't graduate, so any suggestion or need more detail about this project please contact me at sinbearzc@Hotmail.com, thank you so much!!!
|
|
|
|
|
Hi all,
I'm using the GetWindowThreadProcessId function, but for some or other reason the function causes an exception. This is what I'm doing...
<br />
char* wndName = "WindowName";<br />
HWND hWnd = NULL;<br />
LPDWORD lpdwProcessId;<br />
int rc;<br />
<br />
hWnd = ::FindWindow(NULL,wndName);<br />
<br />
rc = GetWindowThreadProcessId(hWnd,lpdwProcessId);<br />
<br />
return rc;<br />
Anyone know what I'm doing wrong??
Thanx in advance
Regards
Programm3r
|
|
|
|
|
You're using an uninitialised pointer ("lpdwProcessId"). Try this instead:
const char *pWndName = "WindowName";
HWND hWnd = ::FindWindow(NULL, pWndName);
DWORD ProcessId;
DWORD ThreadId = GetWindowThreadProcessId(hWnd, &ProcessId);
return ProcessId;
Steve
|
|
|
|
|
Thanx Steve....
Regards
Programm3r
|
|
|
|
|
, Need to refresh page frequently.
|
|
|
|
|
Programm3r wrote: LPDWORD lpdwProcessId;
//return value
int rc;
//get a window handle
hWnd = ::FindWindow(NULL,wndName);
//get the pid of the process that created the window
rc = GetWindowThreadProcessId(hWnd,lpdwProcessId);
Again , here you are passing invalid memmory to function GetWindowThreadProcessId .
Use DWORD dwProcessId; instead and pass its address as parameter.
,Stephan has already answered this.
|
|
|
|
|
Prasad, thank you for the concern and help...
I got it working
Regards
Programm3r
|
|
|
|
|
What kind of problem u got
|
|
|
|
|
Problem solved ... thanx for the concern..
Regards
Programm3r
|
|
|
|
|
Hi guys,
I have added ToolBars and MenuBars from the Resource. I want to show more than 1 toolbars and menubars in my SDI Application. Can any one plz show how to display the menu bars and tool bars.
Thanks in Advance
Velayudhan
|
|
|
|
|
Did you search in codeproject?
|
|
|
|
|
Hi All,
Do any one know abt problems in DDX.
I can send data from Control to variable but when I tried to send data from variable to control my application get hangs.
I had created the dialog using CreateIndirect method.
|
|
|
|
|
|
I am not getting any error,
I craeted Tab control dialog then i called two other dialogs in tab control using Create Indirect Method.
I am able to enetered data in dialog boxe controls and I can send them in Database also, but when I try to send date to control from member variable application get hangs.
|
|
|
|
|
Now application got abort and it had breaked and in debugging it showed below code.
CStringData* GetData() const throw()<br />
{<br />
<big>---></big> return( reinterpret_cast< CStringData* >( m_pszData )-1 );<br />
}
Can you pls explain what is meant by this.
|
|
|
|
|
|
Means to find when some process is running example notepad.exe or word.exe is running in OS. How can I find if notepad.exe is running in OS.
|
|
|
|
|
<br />
HANDLE h_pro;<br />
HANDLE h_sna;<br />
PROCESSENTRY32 pe_sen = {0};<br />
<br />
int result;<br />
bool returnValue;<br />
bool counter = false;<br />
<br />
char* ProcessNames = appName;
<br />
h_sna = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);<br />
if (h_sna == INVALID_HANDLE_VALUE){<br />
returnValue = false;<br />
return (returnValue);<br />
}<br />
<br />
pe_sen.dwSize = sizeof(PROCESSENTRY32);<br />
<br />
try{<br />
if (Process32First(h_sna, &pe_sen))<br />
{<br />
do<br />
{<br />
h_pro = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pe_sen.th32ProcessID); <br />
CloseHandle (h_pro);<br />
<br />
if (pe_sen.th32ProcessID != 0)<br />
{<br />
result = strcmp (pe_sen.szExeFile,ProcessNames);<br />
<br />
if(result > 0){ <br />
returnValue = false;<br />
}<br />
else if (result < 0){ <br />
returnValue = false;<br />
}<br />
else<br />
{<br />
globalVariable = pe_sen.th32ProcessID;<br />
counter = true;<br />
}<br />
}<br />
} while (Process32Next(h_sna, &pe_sen));<br />
} <br />
}<br />
catch(...)<br />
{ <br />
returnValue = false;<br />
}<br />
<br />
if (counter)<br />
return counter;<br />
return returnValue;<br />
<br />
CloseHandle (h_sna);<br />
Regards
Programm3r
|
|
|
|
|
What more can you ask for....
Regards
Programm3r
|
|
|
|
|
Thanks for ur kind help
|
|
|
|
|
Did you come right????
Regards
Programm3r
|
|
|
|
|
|
Thank u I will try this one
|
|
|
|
|
Hi,
How can i declare a global variable which can be shared between different projects.
All these projects are under one workspace.
There is one main project which starts the application.
workspce trial.
proj1
proj2
proj3
proj4
proj5
proj3 is a dialog based main application and the other projects are Activex/Dialog based
I want to declare a variable in proj3 and access this variable from other projects.
Thanks,
kk_mfc
|
|
|
|