|
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?
|
|
|
|
|
access denied usually means either you don't have the right security permissions, or the file maybe in use elsewhere, or it is a system file
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
I have been looking, to no avail, for a way to add an item to the context menu of a printer - i have tried all the sample shell extensions that i could find source for, and can not get any of them to work with the printer object. I am pretty sure that I am setting the registry correctly, but seems like extenstion not working. Any help appreciated.
|
|
|
|
|
Be Warned:
With all things relating to the windows printing subsystem, make sure that the documentation that you are refering to notes if it is for NT or 9x.
There is a TON of cool stuff that you can do with the NT print spooler that you can't just do under Win9x.
|
|
|
|
|
I only need it for Win2K - even so, I have 95/98 code in there just in case someone decides to run it on those OS's. Any experience with shell extensions in ATL for non-filesystem objects ?
|
|
|
|
|
I am now on a huge proj for visual c++ and would really appreaciate some help...i have a workspace for all common programs and others for functional ones. i'm able to compile and build .exe file for the functinal source codes but when it comes to the common workspace, i receive the above msg...i have checked and sure that all the .lib and .h files are included so what seems to be the problem?
thanks in advance
|
|
|
|
|
are you saying that half the apps can log-on and half can't?
if so, check the log-on parameters and such ... otherwise your question is not very clearly stated so its difficult to understand the problems you are having
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|