|
Hi Tran Ngoc Minh
you can use GetOpenFileName
|
|
|
|
|
::OPENFILENAME ofn;
char *szFileName=new char[1024];
ZeroMemory(szFileName, sizeof(szFileName));
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
ofn.lpstrFilter = "*.bmp;*.*";
ofn.lpstrFile =szFileName;
ofn.nMaxFile = 1024;
ofn.Flags = OFN_EXPLORER | FN_FILEMUSTEXIST|OFN_ALLOWMULTISELECT|OFN_READONLY;
ofn.lpstrDefExt = "bmp";
CString str;
if(GetOpenFileName(&ofn))
{
CString str=ofn.lpstrFileTitle ;//szFileName ;
CString temp;
str.TrimLeft();
int index;
while(str.GetLength()>0)
{
index=str.Find('\0') ;
temp=str.Left(index);
str=str.Mid(index+1,str.GetLength()-1);
}
}
From the above you can get the name of the selected file
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|
To show the Browse dialog use CFileDialog class.
nave
|
|
|
|
|
Tran Ngoc Minh wrote: I've a "Help.chm" module,I want to call this
module in win32
You need to include htmlhelp.h and html.lib, then from your code call the HtmlHelp() function.
A point to note, the .lib file will add extra size to your exe, I little too much in my opinion. But the function gives you the ability to do more than simply open the file. If you want to leave this out call either the ShellExecute() or WinExec() function. This will open the help file, though your program will have no control over it.
|
|
|
|
|
Hi.
a menu:
menu1
...Item1
...Item2
...Item3
If TrackPopupMenu() this menu, How can get it string (menu1) and item ID or string(item1,item2...) form WM_INITMENU or WM_INITMENUPOPUP message
Thanks.
|
|
|
|
|
Well your description doesnot explains your question.
Anyway if you need the ID of your menu Items you can get it in WM_COMMAND
you see it under wParam. and check your ID's. Which menu Item is selected.
Cheers
"Peace of mind through Technology"
|
|
|
|
|
Hello
How about GetMenuItemID, GetMenuString methods of CMenu.
|
|
|
|
|
menu1
...
...
umm, if get menu1, GetMenuString can get? it id is?
|
|
|
|
|
If u want to find id of menu item then try using GetMenuItemID method.
int nPos = FindMenuItem(pMyMenu, _T("MyMenuItem"));
UINT menuItemID = pMyMenu->GetMenuItemID(nPos);
|
|
|
|
|
how can we dump every char in an multiline edit box???
HelpMe
|
|
|
|
|
What does 'dump' mean. Do you want to clear the text box ? Do you want to grab all the text to a string ? What ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Maybe he wants to display one of every character in the full character set in his text box?
Maybe he solved it himself already.
Doesn't look like he's going to tell you, though.
|
|
|
|
|
How do i write text on a bitmap file where only the path of the bitmap file is given?
|
|
|
|
|
If it's a bmp, LoadImage will load it. Otherwise, GDI+ will probably load it. Then you need to select it into a DC, draw text on it and save it again ( which probably means you need GDI+ and will load it into a Graphics object ). I have several articles on gDI+ here, one of them is called 'doodle' - it will show you how to load and save an image, and draw on it. Just change the code to draw text instead.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I cant find the the article... would u mind giving me the link?
Its a bmp but not not necessarily in the resource folder...
|
|
|
|
|
I don't see how you could miss it. I typed 'doodle' in to the search and it was the first hit. You could also click on my name and 'view articles'.
http://www.codeproject.com/vcpp/gdiplus/doodle.asp[^]
The bmp would have to be on disc, not a resource.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
CImage m_Image;
m_Image.Load("d:\\picture.bmp");
in the function OnPaint(event WM_PAINT)
CPaintDC dc(this); // device context for painting
BitBlt(dc.m_hDC,0,0,800,600,hdc,0,0,SRCCOPY);
dc.TextOut(40,40,"test",5);
|
|
|
|
|
Hey, just trying to use a variable to hold multiple values so that I can then send those values back to my originating app. I have three values that I need to store in my variable before I return it.
I am using something like this:
for(d=alldevs; d; d=d->next)
{
if (d->description) {
strcpy(descp,d->description);
//strcpy(dev,descp);
}
}
return dev;
If I uncomment the commented line, I see only the second value, if left as is, I see only the first value, I of course, want all three or as many as there will be --probably no more than three. I am trying to enum the adapters in the system, btw.
Any help is appreciated, as always. If you need more info, please let me know. have a good day and thanks in advance.
EDIT: figured it out --I used strcat instead of strcpy and it works. thanks anyway.
-- modified at 19:37 Sunday 2nd April, 2006
|
|
|
|
|
I need some help getting a edit window to select, copy and paste text.
An article on the subject would be helpful or an example of code.
Thanks
Merlin Vilhauer
|
|
|
|
|
How do you mean ? You have an edit control and you want to select and copy text out of it ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi guys, I have a problem concerning a constructor.
I have a code like this:
CClass *pClass;
pClass = new CClass();
pClass->CClass::CClass( param1, param2 );
CClass has 2 constructors, the first called with new, and the second one has to be called after it.
The VC compiler accepts this syntax, but GCC does not.
What can I do? Redesign won't work, I need it exactly like this!!
Thanks for advice,
Alex
Don't try it, just do it!
|
|
|
|
|
Simply speaking, you can't. I am actually surprised that it compiles with VC++.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I have to and I know that it works for GCC, too... I just don't know the syntax, that's the problem.
Don't try it, just do it!
|
|
|
|
|
You are not really calling 2 constructors, you are only calling one, then calling an function, which happens to be an overloaded constructor.
Overloading functions is ok, but some compilers will complain if you try overloading a constructor. Perhaps you should create just the one and pass null values to the first call.
I'm curious to know why you need it to be like this?
|
|
|
|
|
CClass *pClass;
pClass = new CClass();
pClass->CClass::CClass( param1, param2 );
What is it you are trying to do here? You are creating a pointer to an object, calling its default constructor which should be
pClass = new CClass; then trying to call it's overloaded constructor. You can only call one of them, calling the second will only initialise a new object. I'm surprised this compiled.
|
|
|
|