|
<code>
//my sample code from http://www.codeproject.com/shell/AutomateShellWindow.asp
CComQIPtr<IServiceProvider> psp(m_pWebBrowser2);
CComPtr<IShellBrowser> psb;
CComPtr<IShellView> psv;
if(psp)
psp->QueryService(SID_STopLevelBrowser,
IID_IShellBrowser,(LPVOID*)&psb);
if(psb)
psb->QueryActiveShellView(&psv);
if(psv)
{
//new code here
CComPtr<IFolderView> pfv(psv);
if(pfv) pfv->SetCurrentViewMode(FVM_THUMBSTRIP);
//end new code
</code>
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
-- modified at 14:11 Tuesday 15th November, 2005
|
|
|
|
|
thanks for the reply
the above code doesn't compile due to
CComPtr<IFolderView> pfv(psv);
i use VC7 DOTNET 2003....
any suggestion?
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
CComPtr<ifolderview> pfv(psv);
I'v modified my post and removed HTML formating.
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
I've used a similar code taken from a page here at code project....
this code doesn't work because when i create new explorer.exe process (and since the registry new entry tells the explorer to be opened in a new process), i see an other explorer.exe in memory,
the enumproc does find it but the class name of the new explorer process is 'Desktop Proxy' (that is what GetClassName returns) only after the window is being show the spy++ tells that the class name is 'CabinetWClass'....
dunno why system works that way....
any thoughts?
really appreciate all your help!
cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote: I've used a similar code taken from a page here at code project....
Which article are you referring to?
YaronNir wrote: this code doesn't work...
That's too bad as it worked fine for me.
YaronNir wrote: any thoughts?
Are you giving the new window enough time to be created before calling EnumWindows() ?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
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"
|
|
|
|