|
|
Manjunath S wrote: once in while (frequency is 1 time for 20 times trying)my whole application closes....
You've got problems elsewhere that are manifesting at the point in which you are using CFileDialog . This code should run 20+ times with no troubles:
CFileDialog dlg(TRUE);
if (dlg.DoModal() == IDOK)
AfxMessageBox(dlg.GetPathName());
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Just an FYI since I don't think these issues are causing this problem (at least not directly) ...
1) Manjunath S wrote: Sleep(50);
Chances are very high that if you are calling Sleep, something is wrong with your design. This is almost always the case when done in GUI code (as is the case here).
2) Manjunath S wrote: filepath2 = (char *) (LPCTSTR) l_strFileName;
LPCTSTR is defined as (const TCHAR*). Aside from the fact that the cast above won't work properly in a UNICODE build, it isn't want you want anyway. You aren't showing what you use filepath2 for, but I'm guessing you will either want it as a CString itself, a List/Array of CStrings, or don't need it at all.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
1.I deleted sleep
2.I need to pass filepath2 as a char* to a function in DLL.
Now the Modified code looks like this ...
void Upload::OnSelect()
{
CFileDialog upload(FALSE);
if(upload.DoModal() == IDOK) {
l_strFileName2 = upload.GetPathName();
MessageBox(l_strFileName2);
/* where filepath3 is a global char* variable */
filepath3 = (char *) (LPCTSTR) l_strFileName2;
m_start.ShowWindow(SW_SHOW);
m_select.ShowWindow(SW_HIDE);
m_edt.SetWindowText(l_strFileName2);
}
}
The above code problem is CfileDialog and whole application closes automatically (once in 18-20 times of Onselect is clicked) .The application closes when i try to select filename in filedialog using keyboard charater(i.e filename first character) )..
Thanking You
Manjunath S
GESL
Bangalore
|
|
|
|
|
Manjunath S wrote: 2.I need to pass filepath2 as a char* to a function in DLL.
Now the Modified code looks like this ...
And the DLL method doesn't take a const char*? If that is the case, what you are doing is still a problem. You are casting away the const on a CString object's private data (which you have no control over). Basically, if the CString object decides to clean up or allocate a bigger block, your pointer is out in the weeds. Try this:
char filepath3[_MAX_PATH] = {0};<br />
void Upload::OnSelect()<br />
{<br />
CFileDialog upload(FALSE);<br />
<br />
if(upload.DoModal() == IDOK) <br />
{<br />
l_strFileName2 = upload.GetPathName();<br />
MessageBox(l_strFileName2);<br />
<br />
strncpy(filepath3, l_strFileName2, _MAX_PATH);<br />
m_edt.SetWindowText(l_strFileName2);<br />
}<br />
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
why do you use Sleep?
whitesky
|
|
|
|
|
Are there any functions available to set the language used for menus/dialogs once a MUI is installed?
The user would manually configure this via: control panel -> regional & language options -> languages tab
Microsoft calls this the UI language and documents functions (GetSystemDefaultUILanguage, GetUserDefaultUILanguage) to get the value, but nothing to set it:
www.microsoft.com/globaldev/reference/localetable.mspx
Thanks for any help
|
|
|
|
|
Hi,
I have created MFC SDI application. I see the title as "Untitled App" after execution. How to change it to the desired one?
I don't see any caption in the form's properties. I have changed the caption
in AboutDialog, but that doesn't help to change to caption of the application.
Thank you.
Harsha
|
|
|
|
|
Turn off the FWS_ADDTOTITLE style in the CFrameWnd
|
|
|
|
|
Note that removing the FWS_ADDTOTITLE style (do in in pre-creation of the CMainFrm window) will only prevent the "untitled" part from appearing - it prevents the document name from going into the title bar.
There is a string in the string table that is used to create the static portion of the caption used in the title bar. Try changing that string to the desired text.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi,
with reference to the article by "Zoran M. Todorovic"--"A Visual Framework:Controls,tabs and splitters",I have created an application with the help of this article.There are 2 tabs on my main window(SDI based MFC-VC++ dot Net-2003 app),and I would like to switch between the two using the main menu,some option like-"Switch:tab1,tab2 etc".If the user clicks on Switch,he has the option of selecting either tab1 or tab-2.
The corresponding tab should come to focus on selection from the menu.
I would be extremely grateful if any one could help me on this.
Thank You very much.
|
|
|
|
|
/*
I'm managing numerous controls as CMyObject for multiple pages in multiple documents (Not CDocument). The PageArrays are allocated on the heap and then placed in the DocArray using "Add". Then the CMyObjects are allocated on the heap and placed in the MyObjectArray using the same. Each document gets some pages, and each page has some controls. I'm using the following abomination to mimic a three dimensional array using the MFC type safe collections...
*/
// Appears to work
typedef CTypedPtrArray<CObArray,CMyObject*> MyObjectArray;
typedef CTypedPtrArray<CObArray,MyObjectArray*> PageArray;
typedef CTypedPtrArray<CObArray,PageArray*> DocArray;
DocArray m_DocArray;
/*
Now, I am trying to provide an object map for each page in each document for quick access to those same CMyObject controls. I am attempting the same except with a map in the third dimension. So it is array, array, then map.
*/
// Does not work. Asserts when trying to add a MyObjectMap
typedef CTypedPtrMap<CMapStringToOb, CString, CMyObject*> MyObjectMap;
typedef CTypedPtrArray<CObArray,MyObjectMap*> PageNameArray;
typedef CTypedPtrArray<CObArray,PageNameArray*> DocNameArray;
DocNameArray m_DocMap;
/*
Attempts to "new" a PageNameArray on the heap and using "add" to put it into the m_DocMap "appears" to work but it asserts when I attempt to index that pointer to add a MyObjectMap allocated on the heap into the PageNameArray...
*/
m_DocMap[nIndex]->Add(pMyObjectMap); // ASSERTS. nIndex is what I'd expect during Trace
/* Also, when I "dot" m_DocMap intellisense does not give me the choices like GetSize().
It gives me
"add()",
"append()",
"copy()",
"ElementAt()",
"GetAt()",
"InsertAt()",
"Operator[]",
"SetAt()",
"SetAtGrow()"
*/
// Does anyone see what I'm doing wrong in the declaration of m_DocMap?
-- modified at 12:21 Wednesday 21st June, 2006
I am coding this using VC++ 2003. I noticed that my intellisense gives me the expected options when I drop the declaration into a VC++ 6.0 project and "dot" the member variable. Not sure if that helps.
|
|
|
|
|
Disregard the question. I discovered my folly.
I thought I had already checked nIndex in a trace but it turns out it was right where one would expect to find the problem. nIndex was the issue.
Sorry about the post.
|
|
|
|
|
Hi guys, somebody can tell me how con i show a list of network interface in my mfc application? jus tell me how con i find devices...
|
|
|
|
|
try to use winpcap, it is easy.
|
|
|
|
|
See if this article is of any help.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I'm creating an MFC application.
I was provided by the manufacturer the following code in a .h file:
#ifdef DEFINE_GUID
// The GUID that is used to identify this device's interface
// {AF1B231E-1180-420b-8CB6-2ED2A53F9F92}
DEFINE_GUID(GUID_DEVINTERFACE_ALTGENERIC, 0xaf1b231e, 0x1180, 0x420b, 0x8c, 0xb6, 0x2e, 0xd2, 0xa5, 0x3f, 0x9f, 0x92);
#endif
I #include this .h file into my .cpp file.
This is the way I use it:
HDEVINFO hDeviceInfo;
hDeviceInfo = SetupDiGetClassDevs(
(LPGUID)&GUID_DEVINTERFACE_ALTGENERIC, NULL, NULL,
DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
I get the following errors:
alt.obj: error LNK2001: unresolved external symbol
_GUID_DEVINTERFACE_ALTGENERIC
c:\...exe: fatal error LNK1120: 1 unresolved externals.
Could someone tell me if I forgot to include a library or something....
Thanks.
Kitty5
|
|
|
|
|
|
Hi All,
We currently have a client-server application written in Win32 and we're in the process of trying to create a slimmed down version of the client software for the Pocket PC. Our application is a fair size, and uses a few in-house developed DLLs for drawing areas etc. We want to be able to use code contained in these .DLLs on our Pocket PC app to avoid multiple copies of the same code in two projects. We're using VS2003.NET for the Win32 development, and eVC 4.0 for the PPC stuff.
Has anyone been in these shoes before? How have they solved the problem?
I thought of creating a similar .DLL in my PPC application, and actually link in the sources files from the original.DLL while adding #ifdefs to the .DLL to include functions that I require, then compile them using the evC compiler, realizing that not all the calls we make the .DLLs will be available in the PPC environment. This could be quite messy, but would eliminate the maintenence issue.
I realize that some of the calls that the Windows .DLL will make, will not be available in the PPC Edition. We will need to address these individually I think.
Any suggestions? Thank you very much.
Mike
|
|
|
|
|
I was told a while back that to get a release build of a project, I click Build on the Build menu, and the project executable is found in the project's debug folder. Recently, I have been told that this build is not a release build, but a debug build. I am trying to get a release version of my program, so any help clarifying how to get a release build of a project would be nice.
Thanks
ps, I am using VS C++ 2005 Express
|
|
|
|
|
If you're using VS 2005:
you should be able to go to Project then properties then under configuration there's a place where you can select release or debug.
If you're using VS 6.0:
you should be able to go to Project then settings then you can select "Settings for:" either Debug or Release
Kitty5
|
|
|
|
|
I am using VS C++ 2005 Express (VS 2005), and I have found that properties window, but I am not sure which setting I need to change to get my project to build in release mode.
|
|
|
|
|
In VS 2003 and VS 2005, the active configuration under build can be selected in a dialog box activated from menu: Build --> Configuration Manager. Then change the value of Active Solution Configuration drop-down list to "Release".
In VS 6, use Build --> Set Active Configuration menu command.
After this rebuild your project.
|
|
|
|
|
Ok, I have changed the setting, Where is my executable built? Is it still in the project's debug folder? Thanks.
-- modified at 11:07 Wednesday 21st June, 2006
I am also getting errors from this process because the compiler says: "cannot open precompiled header: \release\test.pch"
I'm not sure what is going wrong. Any ideas? Thanks
|
|
|
|
|
In the projects Release folder.
|
|
|
|