|
Hi
How to get the number of instances of an application is running presently.
Is anyway FindWindow function is useful in this regard?
Thanks
|
|
|
|
|
snprani@yahoo.com wrote: Is anyway FindWindow function is useful in this regard?
Yes.
But there are drawbacks[^] too...
Nibu thomas
Software Developer
|
|
|
|
|
#pragma data_seg("Shared")
volatile LONG g_lApplicationInstances = 0;
#pragma data_seg()
This will help you in creating a shared section . This variable will be shared by all the instances . So what you have to do now is to have control of the variable g_lApplicationInstances that is shared
You can use interlockexchangeAdd
InterlockedExchangeAdd((PLONG) &g_lApplicationInstances, -1);
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
You also need the following line:
#pragma comment(linker, "/SECTION:Shared,RWS")
Without it I believe the segment will not actually be shared.
Steve
|
|
|
|
|
Yes you are right.
This will enable you to modify the variable and make the shared variable read write etc,
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
Hi to all,
how to get the Main window handle. My application is MDI. So what will be the main window? Is Application window or Frame window?
Please help me in this regard.
Thanks in advance.
|
|
|
|
|
AfxGetMainWnd()
Nibu thomas
Software Developer
|
|
|
|
|
hello,
I'am searching a tool for Profiling and Error Detection.
Can anyone suggest an good but not expensive tool?
#define expensive >1000$
thanks
|
|
|
|
|
I want to open file which is already exclusively opened by other process
any way i want the solution.If there is any way to do this,then give me
solution. pls help me.
thanks in advance
nirmal
-- modified at 6:50 Friday 3rd March, 2006
|
|
|
|
|
if u use cfile class to open a file. some options are available on the Open function of openflag parameter. like that CFile::shareDenyRead, CFile::shareDenyWrite and CFile::shareExclusive. for more details review msdn cfile constructor help.
Have A Nice Day!
Murali.M
|
|
|
|
|
but it is already opened by another program in CFile::shareExclusive mode,that is currently running in the system.so is there any way to open
that perticular file in my program at the same time?
nirmal
|
|
|
|
|
yes it is possible...but only from kernel-mode with a device-driver. You must use the IoCreateFile call to open a handle to the file - this bypasses the security/access checks so you must never use this technique on a 'real' system!
james
http://www.catch22.net
|
|
|
|
|
I wanna how to develop window app with c. petzold book programming windows also use vc resource editor .
corresponding question:Is the resource compiler a must for window programming? that is ,to develop window app, must I have c compiler, linker, resource compiler?
|
|
|
|
|
i don't think you need the resource compier as a "must" for windoww programming.
you can always create your windows at runtime, but that's very expensive efforts
|
|
|
|
|
i have to use CXimage class in my project.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
i think that this question relates more to the CxImage article, so you should ask this in the article's message board[^] at the bottom of the article...
|
|
|
|
|
1.i want hook some windows get them message and management.
... ...()
{
...
// one window hWnd created
CMyWnd *pWnd = new CMyWnd;
if (pWnd) pWnd->SubclassWindow(hWnd);
...
}
one window created then new a CMyWnd to subclass the window, but more windows that need more memory. how to fix?
do you have some good idea?
2. SubclassWindow one window,final must need UnSubclassWindow?
|
|
|
|
|
U don't have to subclass a window to get all the messages to that window.
There r two ways
1) Replace the window proc of that window with one of yours( don't forget to call the original one in your window proc )
or
2) Install a hook using SetWindowsHookEx()
nave
|
|
|
|
|
thanks.
1. Replace the window proc and SubclassWindow is different?
2. if i use SetWindowsHookEx get all message maybe the will slow.
i want high efficiency management SOME WINDOWS, and same classname window do same something. (if can only use C that is good).
|
|
|
|
|
Even though while subclassing the proc is repaced, u have to new a CWnd class for subclassing. isn't? But if we are repacing the proc we don't have to new any pointers
nave
|
|
|
|
|
i know, that is my base idea. but i need in some windows create some childwindows, only in one function to do that is so difficulty, management childwindows and windows not expedient, but in one CWnd, you only do about one window thing.
|
|
|
|
|
This whole world of dealing with certificates and stuff, kinda sucks.
None of it really makes any sense.
Anyhow, I need to put together a build process.
And, I need to sign all of the exe's and dll's I make.
But using signcode, it asks me to type in the password for my private key.
Is there any way to automate this?
Do you have any references to good sites that explain this?
Are there alternative tools for signing that could help me?
Thanks!
P.S. I know this doesn't really belong in this forum, but this is where the smart folks are....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
|
yuk.
Do you know of any alternatives to signcode?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
I found this handy program on the net....
int _tmain(int argc, _TCHAR* argv[])
{
if ( argc != 2 )
{
printf( "SignHelper CommandLine: SIGNHELPER {private-key-password}\n");
return -1;
}
char *pwd = argv[1];
// Password for auto-filling Signcode.exe's password dlg
#define SIGNCODE_DLG_TITLE "Enter Private Key Password"
BOOL fPwdSet = FALSE;
while(TRUE)
{
// Try to find Signcode's dialog
HWND hDlg = ::FindWindow("#32770", SIGNCODE_DLG_TITLE);
if(hDlg)
{
// Find the pwd edit box and the OK button
HWND hEdit = ::GetDlgItem(hDlg, 0x1F5);
HWND hOK = ::GetDlgItem(hDlg, IDOK);
if(hEdit && hOK)
{
// In Win32 you can't do a WM_SETTEXT to a wnd in another process.
// Instead, "type" the passwd, char by char, to the pwd edit box
LPCSTR psPwChar = pwd;
while(*psPwChar)
{
::PostMessage(hEdit, WM_CHAR, *psPwChar, 0);
psPwChar++;
}
// Now "click" the pwd dlg's OK button
::PostMessage(hOK, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(3,3));
::PostMessage(hOK, WM_LBUTTONUP, 0, MAKELPARAM(3,3));
fPwdSet = TRUE;
}
}
// Don't hog the CPU while we're waitingto find the dlg
Sleep(100);
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
-- modified at 3:52 Friday 3rd March, 2006
|
|
|
|