|
Great! But a nagging question. I'm new to pointers. Now ,I thought that when you declare something as char* you have to do a new to allocate memory before you can use it. Yet in the SafeArrayAccessData and also your *szStr, all we have is the pointer declaration, but no memory allocated for its contents. Sorry if this is an obvious question.
Thanks for the nifty suggestion.
ns
|
|
|
|
|
A SafeArray has the data allocated somewhere in its internal buffer. When you call SafeArrayAccess Data, the interal buffer is locked and a pointer to it is returned to you. This means that you do not have to copy the data, but you'll have to keep the safearray locked. Remember to call SafeArrayUnaccessData when you're done with the pointer!
James
Drinking In The Sun
Forgot Password?
|
|
|
|
|
|
Ok, I work with VB professionally, however I am about to make the jump into working on a possible project using MFC (applaud later ). I know this may sound like a dumb question but if I wanted to have a button show what a dialog window to open a file I know in VB we use the CommonDialog component. What do you do for MFC? I was looking around and I can see that you can insert a resource but that wasn't very clear to me. Can someone point me in the right direction, thanks in advance?
Nick Parker
|
|
|
|
|
|
Michael Dunn wrote:
I think you're talking about the standard file open dialog? MFC has CFileDialog.
Thanks Mike,
That's exactly what I was looking for.
I tried to do
CFileDialog cf;
cf.ShowWindow();
but I get an error saying "'CFileDialog' : no appropriate default constructor available"
Nick Parker
|
|
|
|
|
RTFM
The CFileDialog constructor has one manadatory parameter, a BOOL indicating whether it's for opening (TRUE) or saving (FALSE). So something like:
CFileDialog dlg ( TRUE );
if ( IDOK == dlg.DoModal() )
{
CString sSelectedFile = dlg.GetPathName();
} You use DoModal() to show a modal dialog.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Crap! You type faster than me!
|
|
|
|
|
Michael Dunn wrote:
RTFM
Which one do you suggest, really? I will give it a try.
Thanks Mike, hopefully I won't get stuck so quickly next time.
Nick Parker
|
|
|
|
|
Just put the cursor on the word CFileDialog, then hit F1 to jump right to the MSDN page on the class.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
WEll, you need to use the non-default constructor.
This is from MSDN.
CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );
so, CFileDialog cf(TRUE); will give you a default Open File dialog.
So you were on the right track.
MSDN is very helpful with this kind of information (either online or integrated into VisualStudio).
Hope this helps!
|
|
|
|
|
I want to realize the effect like Book page turning (flip),How can I make it,
where can I find a sample code ,thanks a lot!
|
|
|
|
|
I used LeadTools[^] for this. Their library is pretty cool. They have quite a few other transitions too.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
But I want the VC source code which can help me to make it,where can I find it?
|
|
|
|
|
If it was easy and commonly available then Leadtools would not be making a quid out of it, would they ?
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
that's the trouble with a site like this ... people get spoiled
-c
WWJD? JWRTFM. found on /.
|
|
|
|
|
Jesus Would Read The Fxxxxx Manual ?
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
yep. cause Jesus wasn't dumb.
-c
WWJD? JWRTFM. found on /.
|
|
|
|
|
Hi -
Does anyone know how to change the browser mouse cursor for a item when the mouse goes over it, I need to have a custom cursor that looks like any image I want for when the mouse goes over it for IE 5.5. I want to program a small activeX style plug-in which can change the mouse cursor. Any idea how to do this?
Cheers, Phil
|
|
|
|
|
http://www.dynamicdrive.com[^] has a nice collection of JavaScript goodies.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have derived a class from CWnd and added it to a dialog using the custom control 'control' (I feel like Austin Powers)
Anyways...I wanna initialize the damn thing, but I don't know what fricken function to do so in...
PreSubclassWindow doesn't seem to work
I used Chris's Bitmap Viewer Custom Control article as a template so i'm lost as to why the above isn't working...???
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
PreSubclassWindow doesn't seem to work
It should. Can you put the breakpoint in the function and check if it fires?
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
I figured out the trivial problem...my bad...
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
What bitwise operator/combination would I use to force a bit...???
Would the following yield the result im looking for..?
1 & 0 = 1
1 & 1 = 1
Basically I wanna ensure the WS_VISIBLE bit is always set.
dwStyle & WS_VISIBLE would accomplish this yes...???
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
dwStyle |= WS_VISIBLE; /ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|