|
Run the application and break at the same location as I mentioned earlier, i.e. where the last TRACE used to be.
Bring up the memory window[^] and have it displaying the memory that surrounds the data for ofn.lpstrFile . What does it look like (write exactly how it looks)? Can you sense a pattern in the data?
I think you should also post how your code looks like at this point.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
as per our logn communication can you explain me one thing,
the output string give the path. its not finding any file after at the end of the path as in your code. is it really in buffer(files)? and if it is then why our control has directly switch over to the first selected file after current folder rather than traversing in the path string.
Amit
|
|
|
|
|
I don't think I understand your question at all.
Have you understood that the data pointed to by ofn.lpstrFile is not really a string, but rather a multitude of strings seperated by a NULL character where the first is the folder path?
As an example:
Let's say you open the file dialog and browse to a directory "C:\MyDocs" and select three files, "File.txt", "File2.txt" and "File3.log". The data pointed to by ofn.lpstrFile will look like this "C:\MyDocs\0File1.txt\0File2.txt\0File3.log\0\0 " which means that if you treat ofn.lpstrFile as a string it will only display "C:\MyDocs" and no file names since strings are "zero-terminated".
The while( *pFilename++ ); statement in my code increments the pFilename pointer until it reaches a "\0" and then increments the pointer once so that dereferencing the pointer will give the first character of the next filename. Or if you treat it as a string it will be the filename. If that character is "\0" as well, then the last selected filename has been handled and that's what the outer while-loop is checking for in my code.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: Let's say you open the file dialog and browse to a directory "C:\MyDocs" and select three files, "File.txt", "File2.txt" and "File3.log". The data pointed to by ofn.lpstrFile will look like this "C:\MyDocs\0File1.txt\0File2.txt\0File3.log\0\0" which means that if you treat ofn.lpstrFile as a string it will only display "C:\MyDocs" and no file names since strings are "zero-terminated".
i seem that when i try to print file name i got the each char less from the starting.
like suppose "C:\MyDocs\0File1.txt\0File2.txt\0File3.log\0\0"
The messagebox series follows.
at first time :\MyDocs
then \MyDocs
then yDocs
then Docs
then ocs
then cs etc.
then I assume that loop comes out after the folders last char,but as you explained it will vartually count files which is in buffer that's ok. then why i got the ???????? mark as still unable to
understand.
The means of that files do not come in the buffer or i am some where wrong??
Amit
|
|
|
|
|
|
amitmistry_petlad wrote: Roger Stoltz wrote:
Bring up the memory window[^]
Please:
http://en.wikipedia.org/wiki/Image:Outputwindow.GIF [^]
Why do you show me an image of the output window when I explicitly ask for the memory window? I even provided a link so you wouldn't misinterpret what I meant.
I also requested that you post the code at this point and you haven't done so either.
This means I cannot help you and I suggest you spend some time to get familiar with the development environment.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: When you allow selecting a multitude of files in the file dialog, i.e. setting the OFN_ALLOWMULTISELECT flag, you should use ::FindFirstFile() / ::FindNextFile()...
Why? Exactly how does the FindFirstFile() /FindNextFile() pair parse through NULL -separated filenames?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
hi,
Can anybody tell me,What is the basic difference between mfc and win32 and also how it differs by it's application????
Thanks in advance
Siddharth
|
|
|
|
|
Basically, MFC's are wrapper classes around the win32 API. Meaning that it is much more faster to develop applications using MFC instead of win32 (but you lose of course in some flexibility).
|
|
|
|
|
MFC -> VC++ wrapping Win32
Win32 -> C APIs only
|
|
|
|
|
toxcct wrote: MFC -> C++ wrapping Win32
You might want to qualify that with:
MFC -> VC++ wrapping Win32
Else some pedantic poster will come along and scorn you for it.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
oh my ! all fixed David, Thx
|
|
|
|
|
|
Hi,
I want my MFC application to hav a tab control that would sport a close button on each tab just like in the new Firefox 2.0 and IE 7.0. Could you please giv me some starters or any hints on how to achieve this ?
thanx a lot !
Eraj
|
|
|
|
|
erajsri wrote: a close button on each tab just like in the new Firefox 2.0 and IE 7.0.
You will have to ownerdraw the tab control and respond to the event that is generated for the close button/icon that you drew on each tab.
Tabs in a tab control also support icons so this may help you further.
Take a look at this style TCS_OWNERDRAWFIXED . Search CP or Google with the keyword (TCS_OWNERDRAWFIXED) to find out samples.
|
|
|
|
|
First you need to draw the tab by your self( so that you can draw a close button in the tab item )
In the WM_LBUTTONDOWN message of the tab ctrl find the tab item below it using the HitTest() function.
Check the clicked point is inside the close button you drawn. If so do the action for close.
nave
|
|
|
|
|
thanx for the quick responses,
I had a fair hunch that this wud hav to deal with OWNER DRAWING. What Im fearing now is the possibility of having my Tab Control supporting the Windows XP themes. I have seen an article on CP that shows how to draw Windows Theming on OWNER DRAWN controls. Rather than having to learn how to OWNER DRAW windows XP themes, is it possible for me to ask the Tab Control to paint itself using Windows Theming, and then allow me to paint the Close button only ? Or is it that I have to do the full tab painting since I require Windows XP theming on the Tab Control ?
thanx
|
|
|
|
|
erajsri wrote: is it possible for me to ask the Tab Control to paint itself using Windows Theming, and then allow me to paint the Close button only ?
I think that too is possible. In the onpaint funtion, after the base class have been done the drawing, try drawing the close button.
MyTab::OnPaint()
{
CTabCtrl::OnPaint();
CClientDC (this);
// Draw Close button for each item.
}
nave
|
|
|
|
|
Ive managed to get a close Button inside the tab control.
I did this using the UxTheme library and requesting it to paint a close button on the tab. But once I set it to TCS_OWNERDRAWFIXED the problem is that the control is not drawn fully and only the button gets drawn. How can I ask Windows to paint the rest of the control for me. In Custom Draw you are able to request the control to send only "important" messages to u and let windows handle the rest itself. Why isnt this possible in Owner Drawn controls ?
|
|
|
|
|
if you r going to implement the tab control as I said in the previous post, no neeed to set TCS_OWNERDRAWFIXED style. Let the windows draw the tab control, after that paint the button over the tab items. Please check my previous post.
nave
|
|
|
|
|
I cud use the method uve mentioned but the problem is that the OnPaint method does not give any information as to where the painting is goin to occur and wat the control state is like. In contrast the Owner Drawing gives a lot of information. If i used the OnPaint method i would be painting close buttons everywhere on the tab control ( Ive no control over where the painting is gonna happen ).
|
|
|
|
|
You have complete control over WHERE painting will happen. You may want/need to paint in response
to WM_NCPAINT instead of WM_PAINT though.
Mark
|
|
|
|
|
Hi all,
I need to display a message as a popup menu on the icon of my application which is on the tray.
It is an MFC application. Is it possible in MFC?
If yes, Please tel how can i do this.
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
see me wrote: Hi all,
I need to display a message as a popup menu on the icon of my application which is on the tray.
It is an MFC application. Is it possible in MFC?
If yes, Please tel how can i do this.
I think you want to display a balloon tip.
Then use Shell_NotifyIcon . CodeProject and MSDN has got samples on this topic. Please search. Here[^] is one such article by Chris.
Hope I got your question.
|
|
|
|