|
Do you need to ShellExecute or CreateProcess?
|
|
|
|
|
The real answer to this question is "If you want to run on Windows Vista as a standard user with UAC enabled" then the answer is definitely ShellExecute.
|
|
|
|
|
Click here ->[^]
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
I would like to implement a simple depends utilty.
Thanks
|
|
|
|
|
Knowing the PE file format, you should be able to go through the imports section.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can you eloborate on that ?
give me something to google on ...
|
|
|
|
|
You could try to google on David's suggestion, "PE format" and that will turn up lots of stuff for you. But here's an article[^] that should help you out also.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
Donate to help Conquer Cancer[ ^]
|
|
|
|
|
This sould get you started:
#include "stdafx.h"
#include <windows.h>
#include <Imagehlp.h>
#include <iostream>
using namespace std;
#pragma comment(lib, "Imagehlp.lib")
void Depends(char *pFile)
{
cout << "\"" << pFile << "\" depends on:" << endl;
LOADED_IMAGE li;
BOOL bOk = MapAndLoad(
pFile,
NULL,
&li,
TRUE,
TRUE
);
if (!bOk)
{
cerr << "MapAndLoad FAILED!" << endl;
return;
}
PIMAGE_NT_HEADERS pNT = li.FileHeader;
PIMAGE_OPTIONAL_HEADER pOpt = &(pNT->OptionalHeader);
PIMAGE_DATA_DIRECTORY pImpDD = &(pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]);
PVOID pVoidIID = ImageRvaToVa(
pNT,
li.MappedAddress,
pImpDD->VirtualAddress,
NULL
);
PIMAGE_IMPORT_DESCRIPTOR pImp = (PIMAGE_IMPORT_DESCRIPTOR)pVoidIID;
for (; pImp->Characteristics!=0; ++pImp)
{
DWORD rvaName = pImp->Name;
PVOID pVoidName = ImageRvaToVa(
pNT,
li.MappedAddress,
rvaName,
NULL
);
char *pName = (char *)pVoidName;
cout << pName << endl;
}
UnMapAndLoad(&li);
}
int main(int argc, char* argv[])
{
if (argc != 2)
{
cout << "Usage:" << endl;
cout << "\tDepends <file>" << endl;
return -1;
}
Depends(argv[1]);
return 0;
}
Steve
|
|
|
|
|
Hi all
I have try to executing a URL using ShellExecute. Following snippet is working fine but whenever run this, a new browser window is created...
ShellExecute(NULL, NULL, "http://forums.microsoft.com/MSDN/AddPost.aspx?ForumID=96&SiteID=1", NULL,NULL, SW_HIDE);
How to execute a particular URL without creation of new browser window in ShellExecute?
Thanks in advance
surezsu
|
|
|
|
|
Can you explain what do you mean by executing a URL because that would clarify your needs and help us to understand your problem better. Currently at least I don't get the point of executing a URL and hiding the window. Why to execute if you don't want to see it?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
well, if he already has a browser window open and he executes a "ShellExecute" in his case it will open a NEW browser window instead
of just re-using the current browser window.
but I'm probably wrong in my translation of the original question.
|
|
|
|
|
OH! Now I see. So probably he should rephrase his Question. That said, I now know the reason for not being able to understand his query.
If IE is currently running don't open it but use the existing window to reflect the content of the URL requested Or else ...( is still in question) Hmm!!!
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: OH! Now I see. So probably he should rephrase his Question.
Why? It made perfect sense to me.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
surezu wrote: How to execute a particular URL without creation of new browser window in ShellExecute?
You can't. ShellExecute() is not going to search for running instances of the program associated with the third argument (i.e., the URL in your case).
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
There is no way you can achieve this using ShellExecute .
Probably, you can consider using IWebBrowser2 Interface[^].
|
|
|
|
|
If you really want to stick onto the shellexecute command, may be configuring the browser to force to open in same window may be useful (I won't prefer )
You can change the settings of internet explorer in "Internet Options" to use same window.
for instance in IE7
You can change HKCU\Software\Microsoft\Internet Explorer\TabbedBrowsing -> ShortcutBehavior to 0, 1, 2.
0 is new window
1 is new tab
2 is current tab or window
or disable tabbed browing and resuse same window as
HKCU\Software\Microsoft\Internet Explorer\Main\AllowWindowReuse
Or Automate Running Instance[^]
I prefer to host in my own application using CHtmlView(MFC)
|
|
|
|
|
|
No. When your application terminates (even without closing the port properly) you will have access to the port. Are you sure you have a COM1 ? You should check with HyperTerminal if you can open the port or not.
EDIT: on a side note, just imagine what would happen if that was true. Can you imagine the mess it would be if, by simply forgetting to close the port, that would break the serial port ?
|
|
|
|
|
Hi,
My VC6 (MFC) project folder contains 60-70 files. I want to put all custom controls and common control class files into a folder and add that folder to my project workspace.
I tried adding a new folder to the "file view" tab and then adding the files to it. But when I debug, I get the error that so-and-so file not found.
Please can you tell me the correct way of doing this?
Thanks,
Tara
|
|
|
|
|
Have you tried this?
Create the folder "common" and put all the classes there with the windows explorer. Then go to "project -> add to project" menu and select the files of the folder.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
I tried it. But sadly it does not work.
Thanks,
Tara
|
|
|
|
|
I am new to this stuff.
I am creating a logging utility. Please help me know what should be included in the initializelog() function. I am also creating a properties file for this from were the initializelog() will read the values. Also what kind of fields should be included in the properties file.
THanks...
|
|
|
|
|
pl_kode wrote: . Please help me know what should be included in the initializelog() function
How would we know that ? what are your requirements ? what are the specifications ?
|
|
|
|
|
pl_kode wrote: Please help me know what should be included in the initializelog() function.
Using my magic eight ball, I foresee initialization-related things going into that function.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
Is there any API exists to convert windows messages such as "WM_CLOSE" into its integer value.
I means when I provide "WM_CLOSE" as a string it should then convert it into its integer value.
Thanks,
Mushq
|
|
|
|