|
-
November 6th, 2008, 05:43 PM
#1
FindWindow(NULL,"windowname") using a string variable instead of "windowname"
As the title suggests I am working on a project and
FindWindow(NULL,"windowname") works fine, but for my project, I need to pull the windowname from a string variable, for example String* Hereitis = "temp.pdf - Adobe Reader". My thought was FindWindow(NULL, Hereitis) would work but instead I get the error can't convert second variable from string to lpcstr. I am using .net visual C++. Here is the section of applicable code
String* view = "c:\\scan\\program\\pdfviewer.txt";
FileStream* fsview = new FileStream(view, FileMode::Open);
StreamReader* srview = new StreamReader(fsview);
String* viewpath = "Start";
viewpath = srview->ReadLine();
fsview->Close();
String* closepath = String::Concat("temp.pdf - ",viewpath);
HWND closer = FindWindow(NULL, closepath);
SendMessage(closer,WM_CLOSE,0,0);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|