|
plz gimme some more detailed explaination or code..
Anyway thanks for replying me...
|
|
|
|
|
//[
BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
{
long lIDChild=0;
char szClasName[_MAX_PATH]={0};
::GetClassName(hwndChild, szClasName,50);
if (strcmp(szClasName,"Edit") ==0) //The Url Edit window (Assumed)
{
char szUrl[_MAX_PATH];//Url String
memset(szUrl, 0, _MAX_PATH);
::SendMessage(hwndChild, WM_GETTEXT, _MAX_PATH, (LPARAM)szUrl);
}
lIDChild = GetWindowLong(hwndChild, GWL_ID);
return TRUE;
}
BOOL CALLBACK EnumProc( HWND hwnd, LPARAM lParam )
{
char szClasName[_MAX_PATH];
DWORD dwThreadId;
HDESK hdesk;
dwThreadId = GetWindowThreadProcessId( hwnd, NULL );
memset(szClasName, 0, _MAX_PATH);
::GetClassName(hwnd, szClasName,50);
if ( (strcmp(szClasName, "CabinetWClass")==0) || (strcmp(szClasName, "IEFrame")==0) )//Explorer or IE window
{
EnumChildWindows(hwnd, EnumChildProc,(LPARAM) NULL); //Enumerate through its child windows
}
hdesk = GetThreadDesktop( dwThreadId );
if( hdesk && hdesk != (HDESK)lParam )
return FALSE;
return TRUE;
}
//]
void CWindTestDlg::OnOK()
{
HDESK hdesk;
hdesk = GetThreadDesktop( GetCurrentThreadId() );
EnumDesktopWindows( hdesk, EnumProc, (LPARAM)hdesk );
return;
}
Just try this. all the best,If any problems please let me know
Manu
|
|
|
|
|
I have a command "regsvr32 "c:\temp\temp.dll", I am executing that in my program by WinExec API, but that API only returns the result that it has executed application "RegSvr32.exe" or not, but i don't get the complete result i.e "regsvr32 "c:\temp\temp.dll" i.e temp.dll has been register sucessfully or not, any hint to get the complete result of a child process.
Warm Regards,
Mushq
|
|
|
|
|
You need to use CreateProcess instead.
It will give you a process handle in one of the structures you pass it.
If CreateProcess returns successfully, WaitForSingleObject the process handle (assuming you are not in a GUI thread) and then call the magic api function GetExitCodeProcess. Oh - and don't forget to CloseHandle on the returned process and thread handles.
HTH
Mike
|
|
|
|
|
It is working perfact.
Mike Thank you very much.
Warm Regards,
Mushq
|
|
|
|
|
I hope you have used this code.
WinExec("regsvr32 c:\\MyDll.dll",0);
If yes, It works perfectly(It show messagebox of succes or failure).
-- modified at 3:45 Friday 1st December, 2006
|
|
|
|
|
Dear Parsad, you are 100% right, but the problem is that I want to run that command in silent mode, with out prompting a message box.
Regards,
Mushq
|
|
|
|
|
then you need to pass this string.
"regsvr32 /s mydll.dll"
|
|
|
|
|
Not necessarily, WinExec("regsvr32 mydll.dll" , SW_HIDE), this can also work for silence.
|
|
|
|
|
NO , it wont(Try it with above code). Second parameter is for window based applications.
You need to mention /s .
As mentioned in MSDN, use CreateProcess , with command line options given.
|
|
|
|
|
Yes you are right, I am extremely sorry of my previous comments.
|
|
|
|
|
Would it not be easier to register the dll yourself (see below).
HINSTANCE hDll;
HRESULT hReply;
HRESULT (FAR *lpDll) (void);
hDll = LoadLibrary(szFile);
if (hDll > (HINSTANCE)32)
{
if (bRegistering)
{
lpDll = (HRESULT (FAR *) (void)) GetProcAddress(hDll, "DllRegisterServer");
}
else
{
lpDll = (HRESULT (FAR *) (void)) GetProcAddress(hDll, "DllUnregisterServer");
}
hReply = (*lpDll)();
if (hReply != 0)
{
}
}
FreeLibrary(hDll);
}
else
{
}
|
|
|
|
|
How can we use CString in WIN32 Application ??
Thanx in advance.
|
|
|
|
|
Why one would like to use CString in WIN32 application? Use std::string instead.
|
|
|
|
|
Define this, and you will have CString in Win32
#define _AFXDLL<br />
#include <afx.h><br />
#include <afxwin.h>
|
|
|
|
|
Make that
#define _AFXDLL<br />
#include <afx.h><br />
#include <afxwin.h><br />
|
|
|
|
|
Hmm, i'm sure i wrote afx.h and afxwin.h! i guess the angled brackets is the culprit!! :P
|
|
|
|
|
Yep... View Source did the trick.
I was just browsing the forum and figured I might as well make it easier for the OP.
I guess that's just one drawback of allowing html in posts.
|
|
|
|
|
Again, why one need to use MFC classes in WIN32 app, if standard library function do ?
|
|
|
|
|
I replied to the wrong person - see my earlier post in the thread.
This way you get the email notification.
Mike
|
|
|
|
|
Problem:
We have a server. Have used VC++ 6.0 compiler. Have used try-catch including catch(...) at several places.
Problem is when there is some problems like SEGV ie memory access violation, control goes to catch(...). Unlike unix there are no signal handlers here for this.
Can we somehow hook the process termination so that before server crashes we can print the stack trace using one written by us?
Problem here is how to hook the process termination??
Compiler used is VC++ 6.0
OS: windows 2000
|
|
|
|
|
I haven't used it in ages since I normally use the C++ try/catch blocks. However, you might read up on Structured Exception Handling, which is a bit of a different thing, and see if it provides the functionality you need.
Hope this points you in the right direction.
|
|
|
|
|
In my application i've to move a specified folder to another location.
suppose currently i've folder "VisualBasic"in "C:\programs\kamalesh\temp\VisualBasic" .Now I want to move this folder to new location like this "C:\programs\kamalesh". this movement should be done by coding... as by coding i'm trying to make a folder in temporary location and after fulfilling my intention i've to move that in exact location...
now the question is how can i do this by mfc coding....
thanks in advance.
kamalesh
|
|
|
|
|
|
I am very much new to MFC..pls ..How to create in MFC Tray Icon..
Dasrimk
|
|
|
|