|
<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
|
|
|
|
|
You would have to make use of header files and make sure the same header is included in all of the projects.
|
|
|
|
|
kk_mfc wrote: global variable which can be shared between different projects
You can save the value in the registry location and then you can use it from any of your project. Alternatively you can write the value into a file and then access it from different projects.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi,
Can anybody help me to get Icon details like its name, target path, working directory whenever it is double-clicked to run the application. This is be using Windows API or in C#.
I have already used IShellLink Interface but its been hard-coded for icon name. Suppose the user changes desktop icon name then also coding should be able to change its working directory. This can be done if I can check the existence of the icon.
Regards.
|
|
|
|
|
dear friends
disturb your you! how to import my own icon in my application? thank you.
Li Zhiyuan
8/06/2006
|
|
|
|
|
li zhiyuan wrote: import my own icon in my application?
Open the resource tab.Right click on .rc file. Select Add Resource.Select icon in the resource type window and then click on the import button. Browse for your .ico file and when done click ok.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
你可以在资源里面建一个图标。然后再保存文件再用你的图标文件覆盖系统生成的那个文件。
图标文件要求是32X32大小的。
这个问题可以去www.csdn.net上面检索。
----------------------------
Jerry yu
Email: fisheryj at gmail.com
|
|
|
|
|
abruti, on parle anglais ici
|
|
|
|
|
Hello
In MFC of VC++6.0, I write a dialog application. I have created a modeless dialog from main dialog. Could you please give me specific instructions to change size of modeless dialog when I get the figures up to date from main dialog?
Infomation
|
|
|
|
|
Hi,
you can use MoveWindow function for changing the size.
Regards
Velayudhan
|
|
|
|
|
You can also use the SetWindowPos API to change the window size run time.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
If you're trying to set the size of the window based on the content, you can use AdjustWindowRect or AdjustWindowRectEx to calculate the size of the new window based on the desired client rectangle.
These functions will convert your client rectangle into a window rectangle, which takes into account title bars, borders, etc. wich you then pass to the MoveWindow or SetWindowPos functions.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
How to show the 'Privacy Report' dialog in CHtmlView Based Application?
Thank you.
tomorrow
|
|
|
|
|
hi,
i can not use these code:
Bitmap* curBitmap = new Bitmap(L"sunset.bmp");
error for this code is:
f:\visual sutido project\ImageProcessing\ImageProcessing\ImageProcessing\ImageProcessingView.cpp(73): error C2660: 'Gdiplus::GdiplusBase::operator new' : function does not take 3 arguments
is any opinion??!!!;)
|
|
|
|
|
|
Hi,
I am having this strange issue that I cant trace because my program works just fine when debugging from within VS or any other debugger (I tried olly as well), but whenever I run it from the explorer it doesnt work completly.
I am reading values from the registry using this Wrapper.
Then Im assigning the value of the key to a variable like this:
char * binaryData = (char *)value.operator LPCTSTR();
Then I'm converting the char from UTF8 to Unicode, but there should not be a problem.
However, the resulting string has in the most cases something appended like "=C:\Pr " which looks like a string to me but I have no idea how it got appended to the registry value.
The strange thing now is that whenever I debug it with VS it works, but when I run it normally from windows it puts those strange characters at the end of the strings.
Btw, my strings are in REG_BINARY format.
Does anyone know what the problem here is?
Thanks,
lucki_luke
|
|
|
|
|
try running from VS without debugger (ctrl-f5?) i think problem must be with env and/or project settings. we faced one similar problem where the error occurred only in release mode. we had to change some 3rd party libraries as far as i remember.
----------------------
Mayank Thakore
Learning C++ - since 1998
They didn't print my card right; so I resigned.
|
|
|
|
|
When running from VS without debugger it doesnt work either, and as I said before it works even when running from OllyDbg.
And Debug or Release mode doesnt matter as it works in both modes with debugger and not without...
I have totally no idea what to do...
|
|
|
|
|
Check for variables that are not initialized.
Debugger mode (or debug build) will initialize variables with some non-zero data, while release mode might contain random data or zeros.
That is usually the difference.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|