|
DavidCrow wrote: Which article are you referring to?
http://www.codeproject.com/shell/AutomateShellWindow.asp (it was one of the replies to this thread)
DavidCrow wrote: That's too bad as it worked fine for me.
how come? which system? xp? with sp? 1 ? 2?
DavidCrow wrote: Are you giving the new window enough time to be created before calling EnumWindows()?
tried to give it 3 to 5 seconds interval.....i use WaitForInputIdeal...
any thoughts?
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote: which system? xp? with sp? 1 ? 2?
Windows XP with SP2.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Finally i've solved the problem
it appeared to be that if i launch web browser (using IWebBrowser2) and set it to my desire
folder, it presents the folder automatically in FilmStrip mode....
so all i had to do is this:
CString szFilesDir(_T("c:\\windows\\system32\\MyDir"));
CComVariant vaURL( ( LPCTSTR) szFilesDir);
CComVariant vtEmpty;
IWebBrowser2Ptr spWB = NULL;
HRESULT hr = spWB.CreateInstance(CLSID_InternetExplorer);
hr = spWB->put_StatusBar(VARIANT_TRUE);
hr = spWB->put_ToolBar(VARIANT_TRUE);
hr = spWB->put_MenuBar(VARIANT_TRUE);
hr = spWB->put_Visible(VARIANT_TRUE);
hr = spWB->Navigate2(&vaURL,&vtEmpty,&vtEmpty,&vtEmpty,&vtEmpty);
thank you very much both of you, for all your help!!!
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
hi
I made a program using VS 2003. This program keep a thread running all the time. When the screensaver start the program show a error message. If I ignory the error the program keep running without problem.
I want to know why that error occur?
=^_______^=
[www.bispenho.com]
|
|
|
|
|
bispenho wrote: This program keep a thread running all the time. When the screensaver start the program show a error message. If I ignory the error the program keep running without problem.
could you tell me the exact error message string.. ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Sorry but the error has occured when the machine get stand-by mode. The message is: Debug Assertion Failed.
I thought weird the fact that I was running a programm just using the exe file but the error message showed me the line and the file name source where the error has occured.
I don't have experience in development using C++ so my other doubt is how the VC can show the .cpp file and line with error when I'm running the program out of VS?
=^_______^=
[www.bispenho.com]
|
|
|
|
|
I can't remember details, but you probably built the EXE in DEBUG mode, not RELEASE mode. DEBUG mode EXE files include debug information like file name and line numbers, etc.
Debug / Release selection is in Project settings, I think (I don't have VS on my office PC.)
|
|
|
|
|
hnn it's true. Thanks a lot =)
|
|
|
|
|
bispenho wrote: Debug Assertion Failed.
What line of what file asserted? That will give you a big clue as to why the program crashed.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi everybody. Do you think it's possible to send a BSTR to VC++ via WM_COPYDATA? I just tried it using a VB Application. VB uses BSTRs and I set up a structure to send which also contains 2 string members. However, when I receive that in VC++, explorer.exe crashes (since the VC++ is actually a DLL hooking explorer.exe). The structure in VB is something like this:
Public Type SomeStructure<br />
zz As String<br />
xx As Long<br />
yy As Long<br />
ss As String<br />
End Type
Translated to VC++ it looks like this:
<br />
struct CustomStructure<br />
{<br />
BSTR sOne;<br />
long lTwo;<br />
long lThree;<br />
BSTR sFour;<br />
};
However, in VB the size of that structure is reported as 16 by the LenB function.
So do you think it's more like a process boundary issue, or simply a mistake in my approach?
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Hello.
If you suspect that the crash is caused by diffrent struct sizes, then pack the VC struct, like this:
<code>
#pragma pack(1)
struct CustomStructure
{
BSTR sOne;
long lTwo;
long lThree;
BSTR sFour;
};
#pragma pack()
</code>
Then your VC struct will be 16 too.
|
|
|
|
|
WM_COPYDATA will only copy the root data in the buffer. Thus things such as pointers to other objects will only have the pointers and not the objects copied. In your case, the BSTR pointers will be copied but the strings the point to will not be.
All the data must be serialized into a single buffer containing no pointers to other data.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi CPians,
Using SHBrowseForFolder, how do I start browsing from a given directory and not from the desktop ?
The pidlRoot parameter of the function seems to be the key, however I do not have the slightest idea how to deal with it. I have one MSDN example where the init directory is set to the current directory, but it uses callbacks and seems to me as using a blockbuster to catch a fly.
Any idea ?
~RaGE();
|
|
|
|
|
|
|
...probably second only to "CListBox?" as the numer one repeated question in the forum...
No, Rage, I am not critisizing you, but Microsofts Documentation in the first place
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hi, excuse me that i write this question in VC++ forum, but i don have idea where to put it...
Can someone tell me from where i can find an algorithm that draws arc,when are given 3 points and radius. I mean arc(int x,int y,int x1,int y1,int x2,int y2,int radious).
I know some algorithms , for example the arc algorith of Bresenham, or the middle point algorithm, but i can not find source code. Please help me.
|
|
|
|
|
gandalf1983 wrote: Hi, excuse me that i write this question in VC++ forum
On What language do you want the source code?
However, I am giving you a link which you could follow to get your solution.
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=9992&lngWId=3[^]
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Hi,
I am exporting classes from a dll, and I try to avoid recompiling the world, when the dll changes. I am feeling uncertain in that point and would greatly appreciate your advice.
I reckoned the only problem would arise when classes with virtual functions would be used by the client. I set up a little experiment with 3 classes A, B and C, with 3 virtual functions each. C inherits from B and B from A.
Found..
I can not change the order of virtual functions, nor can I insert one. The vftable entries seem to be permuted resp shifted by the number of insertions.
I can insert additional code into a function, so that the function entries in the map file have shifted adresses. But still the client works without recompiling. I thought it would crash, why not does it? I thought this would result in wrong vftable entries. Are these not generated at dll compile time?
These problems only seem occur when I use pointers to instances of these classes. I.e. as long as I do not pass any instance from a dll class via reference, or make a pointer to it, I will not have to recompile the client. True?
Best regards
Werner
|
|
|
|
|
First, I'm no expert on this, so I may be wrong.
As I understand it you have three questions:
1: Why does your vtable still works although the functions in the dll have changed base adresses?
2: When are vtables generated?
3: How are dlls linked to the main app?
1: (actually ties in with two and three, but here goes) The vtable is populated at compile time. The main app calls the virtual function through the vtable, but reads the vtabel at runtime, not compile time. That's why it will work as long as the entries in the vtable doesn't change position. For instance, it's important that the adress of CYourClass::Foo is always the second entry in the vtable, but it's not important (at compile time) what the actual value of the second entry is.
2: at compile time.
3: When the app is started the dlls that it depends on are loaded (in theory, at least), and the entries into the dll are read from the export table. This is dynamic linking, where the function calls are resolved at runtime. Even though your statically link to your dll Windows will still dynamically link the dll - all the LoadLibrary and GetProcAddress calls are just done behind the scenes. So, as long as the app can find the right entries in the table the dll will work.
Why it doesn't work with function pointers is a little more unclear to me, but that will of course depend on how you construct and use the pointers.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thank you!
The vtable is populated at compile time. The main app calls the virtual function through the vtable, but reads the vtabel at runtime, not compile time.
> => when I insert a virtual function or change its position, the the client will read a wrong function address instead of the original one, if it does use the vtable.
Why it doesn't work with function pointers is a little more unclear to me, but that will of course depend on how you construct and use the pointers.
> you gave the answer. When I use a class from a dll this way
MyDllClass theClass;
theClass.aVirtualFunc(); // the vtable will not be used when calling this function (right?). It's clear, to which class aVirtualFunc refers, it can be referred to by it's export name or ordinal.
But here
MyDllBaseClass * ptheClass = new(MyDllClass);
ptheClass->aVirtualFunc(); // the vtable will be used. Beware of changing the functions position in the dll without recompiling the client. The wrong function will be used
(it happened also when I used a MyDllClass * instead of MyDllBaseClass *).
or even here, I think - and less obvious -
MyDllClass theClass;
doSomethingWith(theClass);
..
void doSomethingWith(MyDllClass & refToMyClass) {.. // because there is an implicit pointer operation.
.
Cheers Werner
|
|
|
|
|
WernerP wrote: MyDllClass theClass;
theClass.aVirtualFunc(); // the vtable will not be used when calling this function (right?). It's clear, to which class aVirtualFunc refers, it can be referred to by it's export name or ordinal.
I think the vtable will be used regardless of whether you use . or ->, but it may be implementation-specific. In any regard, you shouldn't count on it.
As cmk wrote, you have no control of the ordinals assigned to the exported functions when you use __declspec(dllexport). So the safest option is to recompile. Anyway, if you headers doesn't change it's only relinking which is pretty fast. If your headers change you need to recompile anyway.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
A dll has functions exported by ordinal, and (optionally) name.
When you create a dll you have 2 ways of exporting data/functions:
1. use an export file
Here you explicitly define the ordinal (and optionally hide the name) of the functions to be exported.
Because you control the ordinal you control any changes that occur between releases.
Usually when new functions are added you just assign them new (unused) ordinal values.
Class methods are exported using their mangled names, which makes this a tedious way of exporting class' by hand, usually you will have another program generate this file.
2. use __declspec(dllexport)
Here the compiler auto-generates the export table from all __declspec(dllexport) it finds.
You have no control over the ordinals assigned to data/functions.
I assume you are using __declspec(dllexport) statements.
What you are talking about is observing an effect and inferring a reason.
You can NOT assume your conclusions will hold for all cases - they won't.
To get the result you want you need to use an export file.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_core_export_functions_from_a_dll_by_ordinal_rather_than_by_name.asp[^]
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Thanks. Option 1 is tedious indeed. I have been looking for ways how to generate a def file with mangled names, they talk about using
(1) the VC++ /FAcs compiler option to get a listing
(2) the VC++ generate map file option when linking
(3) the DUMPBIN.EXE on the dll
to get the mangled names.
There is also a tool from
http://www.objmedia.demon.co.uk/freeSoftware/def32.html[^]
which creates a def file from the map file and also assigns ordinals to it. The result looks ok (but haven't yet tested compiling and linking).
regards Werner
|
|
|
|
|
The ObjMedia tool looks promising.
...cmk
Save the whales - collect the whole set
|
|
|
|