|
Hi,
In my application, I store an array of TCHAR[MAX_PATH] strings into an vector as indicated by the code snippet below.
#include <vector>
typedef std::vector<std::basic_string<TCHAR>> StringVector;
BOOL CMyApp::AddStringToVector()
{
StringVector vect;
vect.push_back(_T("One"));
vect.push_back(_T("two"));
vect.push_back(_T("three"));
TCHAR szResult[MAX_PATH]={0};
_tcscpy(szResult, vect[1]);
}
I am able to add all the string. But accessing the stored string from the vector is the problem.
_tcscpy(szResult, vect[1]); gives an compilation error
Error 11 error C2664: 'wcscpy' : cannot convert parameter 2 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'const wchar_t *'
I think this error is caused because the TCHAR that is stored in the vector as std::basic_string<_Elem,_Traits,_Ax> and that the compiler is not able to convert it to an TCHAR[MAX_PATH].
How do I go about accessing the TCHAR elements in the vector?
Please help.
|
|
|
|
|
Got the solution.
I should be using to access the TCHAR stored in the vector as given below.
_tcscpy(szResult, vect[1].c_str());
|
|
|
|
|
I have an excel file which is connecting with some other network application and continously updating the excel file. now i want to see that data on my gui . what is the required api for it
Trioum
|
|
|
|
|
Which message gets processed by application when user presses "windows+d" or clicks "show desktop" icon in quick launch so application minimizes?
|
|
|
|
|
Well, you get a WM_SIZE[^] message when your window gets minimized but i doubt there is a way to distinguish between the event of "show desktop" and any other cause of minimizing (like the user clicking the minimize button). Why do you have to know that?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I have application, in custome menu I have option "minimize", by clicking on it application goes to sys tray, now menu option would be "restore" ...but that two case(mentioned in Q) option remains "minimize" as application is minimized all ready? it shud be "restore"
|
|
|
|
|
Well, WM_SIZE[^] with SIZE_MINIMIZED in lParam should tell you your app got minimized and i guess SIZE_RESTORED should tell you if it got restored or SIZE_MAXIMIZED if it got maximized, but if i were you i would rather query the window'S state using GetWindowPlacement[^] and set my menu item accordingly every time the menu is shown, i think it is easier to handle than tracking some flag thoroughout the application...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Application does not get WM_SIZE message in both case mentioned in Q.
|
|
|
|
|
Hmm, you are right, one would think it would get a WM_SIZE, same with WM_WINDOWPOSCHANGED...sorry about that...i see what else i find, if i figure out anything i will get back to you...how about GetWindowPlacement mentioned in my other[^] post?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Still I'm confused, application minimizes (in both cases) but message Q does not process any message how this is possible?
|
|
|
|
|
I have found several answers to what happens with a window when the desktop is shown, so now i am also confused:
-the window gets minimized
-the window gets hidden
-the window gets moved to a poisition way outside of the visible area
-the desktop window simply overlaps the window (so the window gets send behind the desktop)
So finding out if your window is hidden or not by "show desktop" seems trickier than we thought...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I show a message box with AfxMessageBox.
However if my main dialog was minimized at that time, only the message box shows, and until OK is clicked the owner won't show even if I click on the program icon in the task bar.
Same if I use a custom dlg with DoModal instead of a message box.
This happens only if the main dlg was minimized, if it was simply out of focus there's no problem.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
modified on Saturday, March 7, 2009 5:31 AM
|
|
|
|
|
That is probably because when you bring up a message box it will become the active window of the process, after it is closed, the active/focused window of the process becomes the parent of the message box, which is your main dialog so it gets restored. I think if you want to show it before you bring up the message box you either have to manually do it or maybe try to capture the WM_ACTIVATE or WM_ACTIVATEAPP messages somewhere and check if your main dialog needs to be shown.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thanks, this gave me the idea to try ShowWindow(SW_RESTORE) before showing the message box, which worked.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
sashoalm wrote:
Same if I use a custom dlg with DoModal instead of a message box.
You need to create a Modaless dialog rather. It's simple, instead of calling doModal, you need to call Create() & ShowWindow(),
More here[^]
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
hi
in an MDI application, where's the best place for calling MDIMaximize?
is there any way better than calling this function? maybe changing styles or something...
thx
|
|
|
|
|
hi,
May i know how can i download an EXE from Webserver to client.....without using the browser.....may be using Cinternetsession...
if possible plese send me the sample code....to
purna2pradeep@gmail.com...
|
|
|
|
|
|
there is a directory containing the executable image file and there is another directory called "process current diretory" and every current diretory per process.
Indeed, what is current directory and where is it?
Any one can help me?
modified on Saturday, March 7, 2009 3:37 AM
|
|
|
|
|
|
basicly, it's what the command CD used to set when people used DOS
so if you open the dos box and type:
CD C:\mydir\
"C:\WINDOWS\notepad.exe"
notepad would have a current directory C:\mydir, not C:\WINDOWS
but since in a GUI you can't explicitly change the current directory i'm not sure what use it has anymore
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi,
if posible please let me know how can i invoke an exe from local machine using _spawnlp or shellexecute in MFC...
|
|
|
|
|
Check here[^]
You may also use CreateProcess().
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
|
I have looked all over the web for a simple serial read/write program in C++ so that i can study it and learn the process of serial communications by EXAMPLE. I have tried the serial library and the demos on this site as well as a bunch of other sites. All i need is a simple program that sends a string to the com port of my choosing with the baud, parity, etc of my choosing. The variables can be simply manipulated and recompiled. I just want to learn this and I am not that experienced with c++, so all the MSDN stuff is confusing to me.
Anything that can mimic a hyper terminal would be more than ideal.
Thanks,
Seb
|
|
|
|