|
the first point ... check how u are maximizing it ... if it wont even close maybe you goofed up some flags
second point ... sheesh ... make life hard why dont u ... best thing i could think of is to look thru the mfc source code and see how they did it or fake it using a modeless dialog
sorry cant be of more help
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
First, I love your quote. Having been in a customer service position before my present position (I installed and maintained semi-conductor equipment before), this quote exemplifies life pretty well!
Second, the reason I'm not using MFC for my app is not to make life harder, but more to understand what's going on behind the scenes. This is a personal project, so there are no time limits (well, I suppose it ought to finished in the next 50 years or so, or I might be dead...). Just more of a curiosity then anything.
Thanks.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
hehe .. the quote comes from bitter experience
your curiosity about windows is admirable
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi there,
Whats the easies and most efficient way to write into the Registry ?
I want to write into HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER keys in
which i want to open a new SubFolder(key) under "Software" folder (key)
(called : MyKey for instance) and under this folder have some properties
of kind : int, and CString.
I also want a method to retrive this data and alter it if necessary.
How can this be done ?
Thank you alot,
Ariel.
|
|
|
|
|
there are 5 registry classes here: http://www.codeproject.com/system/
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Excellent Reference - Thank you very much for the Answer !!!
|
|
|
|
|
I wrote a simple class to do with registry. You should contact me.
|
|
|
|
|
Well first i found some wrapper calsses for the Registry handling but i'm always open to new and improved ones.
Hope you can show me the headers or all the class code throw a reply or simply by mail.
Thank you for the time,
Ariel.
|
|
|
|
|
Hi there,
Some MFC Process Checking :
1. How can i check if a process is running in the same machine already ?
(I mean i want to run the same process/App. only once in the machine -
how can i check if the process is already running on the machine ?)
2. How can i do the same to check if the process is running in the network ?
(I have a Lan Network of Lan and i want to check if the process/App. is
already running on one of the machines (pc) is this possible ?)
Thank you alot,
Ariel.
|
|
|
|
|
use EnumProcesses to get a list of running processes and look for the one you are interested in
to detect on a network machine i would build a small messaging system into the app that responds to a ping on a specified port ... as the app starts up try pinging the port on each machine and see if you get response ... if not u night be able to assume it isnt running ... security allowing and all
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi there,
Firstly, Thank you very much for the answer.
I would like 2 ask 2 more favours if you can :
1. Can you show me a small example of the EnumProcesses - how to catch the processes ?
2. On a Network if i'm actually running all the processes on a disk of one machine (which means i access \\AnotherComp\c\APP\MyApp.exe and thats the only place where the source is. Does this change the answer you gave for Network pinging ? Can you explain a bit more about it ? (Code headers will be apritiated here too)
Thanks again for your answer,
Ariel.
|
|
|
|
|
when you run an app from a network drive the app gets copied to the local machine and executes there so it makes no difference where it is stored ... the tlist example is a good place to look at process enumeration ... there are several chat and ping utilities here also that will do all you need for network communication between machines
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
|
Thank you alot for this - i think its very usefull - i'll give it a better look soon.
Just wanted to thank you,
Ariel.
|
|
|
|
|
Glad it helped.
Any time, Most welcome!
|
|
|
|
|
|
Hello, may someone can help me?
I have used the Component Gallery to create modeless PropertySheet embeded in
a CMiniFrame Window with a PreViewWindow. After that I change the CMiniFrame to CFrameWnd because I want to have a SystemMenu and MinimizedBox in the Caption, also I do not want a toolbar caption.
Problem: the PropertySheet in the CFrameWnd looks (normal) embedded in the frame border
Question: How can I set the style, else in ::Create, with Create() or in OnCreate or ::PrecreatWindow that all together looks like a normal PropertySheet Dialag?
Until yet no comination of window style works.
Harald
mailto:development@langner.net
(Germany - Frankfurt at Main)
|
|
|
|
|
I coded an application using hook events but when I trace events in debug mode, only the events sent by this application are catched!! The application doesn't catch others events from Windows!!
My hook functions are in a dll, I don't understand!!
|
|
|
|
|
Can u clarify more on this or how you r using SetWindowsHookEx()??
|
|
|
|
|
Of course!!
In my dll, i've coded the methods called by SetWindowsHookEx():
extern "C" LRESULT CALLBACK
SpyGetMsgProc(INT hCode, WPARAM wParam, LPARAM lParam)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
...
// Windows messages are taken here
return CallNextHookEx(NULL, hCode, wParam, lParam);
}
extern "C" LRESULT CALLBACK
SpyCallWndProc(INT hCode, WPARAM wParam, LPARAM lParam)
{
// like SpyGetMsgProc()
}
and in my program i coded a method SetSpyHook() which use SetWindowsHookEx():
BOOL SetSpyHook(BOOL bSet)
{
static HHOOK hhkGetMessage = NULL;
static HHOOK hhkCallWndProc = NULL;
static HMODULE hmodHook = NULL;
hmodHook = LoadLibrary("Hook");
...
hhkGetMessage = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)GetProcAddress(hmodHook, "SpyGetMsgProc"), hmodHook, 0);
...
hhkCallWndProc = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)GetProcAddress(hmodHook, "SpyCallWndProc"), hmodHook, 0);
...
}
My application works, but it catch only its messages!! I can't catch all messages from the others windows (like Spy++)!!
Thanks for your help...
|
|
|
|
|
I have seen the same problem while working on my current project (a Windows NT shell replacement). I assumed that the debugger was unable to display TRACE events that were not in the process space of the application it was currently debugging, but I do not know that for sure.
I ended up writing my own TRACE implementation that uses a memory map file to hold a table of debug strings. After writing the TRACE viewer application, I was able to determine that the hooks were indeed being hit by different applications (my custom TRACE macros automatically display the process and thread handles of the calling process and thread).
I think this is simply an issue with the capabilities of the debugger itself.
|
|
|
|
|
Hi!
Anyone want to help me out?
I implemented a tray icon in my program and everything is working great in the way I want it to be. However, there's a slight problem. The popup menu doesn't disappear right away if I click outside the popup menu. But it will disappear if I move the cursor back to the popup menu.
Any idea what is wrong with my code?
#define WM_NOTIFYICON WM_USER + 50
HWND g_hWnd;
HINSTANCE g_hInst;
HICON g_hIcon;
BOOL TrayMessage(HWND hWnd, DWORD dwMsg, UINT uId)
{
NOTIFYICONDATA nd;
nd.cbSize = sizeof(NOTIFYICONDATA);
nd.hWnd = hWnd;
nd.uID = uId;
nd.uFlags = NIF_MESSAGE | NIF_ICON;
nd.uCallbackMessage = WM_NOTIFYICON;
nd.hIcon = g_hIcon;
return Shell_NotifyIcon(dwMsg, &nd);
}
void NotifyAdd()
{
TrayMessage(g_hWnd, NIM_ADD, 777);
}
void NotifyDelete()
{
TrayMessage(g_hWnd, NIM_DELETE, 777);
}
void OnContextMenu()
{
HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU1));
HMENU hPopup = GetSubMenu(hMenu, 0);
POINT pt;
GetCursorPos(&pt);
TrackPopupMenu(hPopup, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_hWnd, NULL);
}
LRESULT OnNotifyIcon(LPARAM lParam)
{
switch (lParam)
{
case WM_RBUTTONUP:
OnContextMenu();
break;
}
return 0;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_CLOSE:
NotifyDelete();
DestroyWindow(hWnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CONTEXTMENU:
OnContextMenu();
break;
case WM_NOTIFYICON:
return OnNotifyIcon(lParam);
}
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int n)
{
MSG msg;
WNDCLASS wc;
memset(&wc, 0, sizeof(WNDCLASS));
wc.style = CS_DBLCLKS;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.hInstance = hInstance;
wc.lpszClassName = "popupwindowClass";
RegisterClass(&wc);
g_hInst = hInstance;
g_hWnd = CreateWindowEx(WS_EX_APPWINDOW, "popupwindowClass",
"popupmenu test", WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
0, 0, 320, 240, NULL, NULL, hInstance, NULL);
if (g_hWnd)
{
g_hIcon = LoadIcon(NULL, IDI_APPLICATION);
ShowWindow(g_hWnd, n);
UpdateWindow(g_hWnd);
NotifyAdd();
}
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
|
|
|
|
|
It's a feature!
Take a look at here.
Daniel
"das leid schlaft in der maschine" -Einstürzende Neubauten
|
|
|
|
|
Thank you. I haven't tried the article's suggestion, but I will see to it today.
|
|
|
|
|
How to delete a file that has a normal attribute but
has an "ACCESS DENIED" permission?
|
|
|
|
|