|
SHELLEXECUTEINFO sei = {0};
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.lpVerb = _T("open");
sei.lpFile = _T("http://news.bbc.co.uk/sport1/hi/olympics_2004/herculympics/default.stm");
sei.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&sei);
WaitForInputIdle(sei.hProcess, INFINITE);
HWND hWnd = FindWindow("IEFrame", NULL);
ShowWindow(hWnd, SW_SHOW);
SetForegroundWindow(hWnd);
SendMessage(hWnd, ...);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi
Thanks for your continued patience good ideas but......
It still doesn't work.
The SHELLEXECUTEINFO method certainly starts the web page but i couldn't figure out what to do next;
The FindWindow methods also works but it doesn't get my WM_CHAR messages
The method suggested by bdiamond is also not working. Here i created a sdi app with HTML view and used SetTimer is to fire the
SendMessage(WM_CHAR, 'B', 1)
Sleep(100)
SendMessage(WM_CHAR, 'N', 1)
As a check to ensure this was working i put an OnChar handler in there to see my messages working
The funny thing is that when you press charcaters in the view (ie the web page) the OnChar does not catch anything, but the man starts swimming if you pressing the B and N as you are supposed to
Again, thanks for any help
|
|
|
|
|
Or you can always put a webbrowser control in an app and set the address and open the page there. then have a button you can press that loops a million times (or whatever) and use a control variable of the ClassWizard-generated class for the browser control and do a sendmessage().
[insert witty comment here]
bdiamond
|
|
|
|
|
I am trying to Create a Directory with Path length > 260 Characters..
Windows is not allowing me to create when length exceds 260 characters..The function i used is CreateDirectory().. When I saw the SDK Documentation it said I need to Use Unicode Version of this function for a maximum path length of 32767.
I want to know wht is this Unicode version function is?? Also do i need to change any settings in Visual Studio if i want to use Unicode Functions..
If possible can any one explain me the above with an example..
Thanks
Sudhakar
|
|
|
|
|
Sudhakar Pasupunuri wrote:
Also do i need to change any settings in Visual Studio if i want to use Unicode Functions..
Yes, you will need to ensure that both UNICODE and _UNICODE are defined. I would do this at the top of stdafx.h before any files are included.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
If you don't want to change your whole app to be Unicode, you can call CreateDirectoryW() directly.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
If I want to right click on a file and open the file with my program MFC how can I do that?
Please heeeeeeelp.
|
|
|
|
|
Larsson wrote:
If I want to right click on a file...
From where, Windows Explorer?
Larsson wrote:
...and open the file with my program MFC how can I do that?
Is the file's type associated with your application?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
MFC code:
<br />
CRegKey *r=new CRegKey(HKEY_CLASSES_ROOT);<br />
<br />
r->RecurseDeleteKey(".xyz");<br />
r->RecurseDeleteKey("xyzfile");<br />
<br />
r->Create(HKEY_CLASSES_ROOT,".xyz");<br />
r->SetStringValue("","xyzfile");<br />
r->Close();<br />
<br />
r->Create(HKEY_CLASSES_ROOT,"xyzfile");<br />
r->SetStringValue("","file description");<br />
r->Close();<br />
<br />
r->Create(HKEY_CLASSES_ROOT,"xyzfile\\shell\\open\\command");<br />
r->SetStringValue("","c:\\YourApplication.exe \"%1\"");<br />
r->Close();<br />
<br />
r->Create(HKEY_CLASSES_ROOT,"xyzfile\\DefaultIcon");<br />
r->SetStringValue("","c:\\YourApplication.ico");<br />
r->Close();<br />
<br />
delete r;<br />
|
|
|
|
|
that was of course association code.
You can also use .reg files during installation.
Look also at this methods:
CWinApp::EnableShellOpen
CWinApp::ParseCommandLine
CWinApp::ProcessShellCommand
|
|
|
|
|
|
Hi !
Our customers ask to add a dll from one of there partners to our project. (I name their dll 'rasterdll' to prevent misunderstandings). I got the libs, dlls and header files from them and add the necessary code to our application. There are 2 small parts I have to add, call a configuration dialog and a line by line processing (image processing; the rasterdll requests line by line and returns the modified lines). I have to say the rasterdll is called from one of our dll's.
Ok, now the problem. The dialog appears as expected but shows some errors (displays a math-calculated pattern, but the last 2 lines are destroyed (~10000 bytes))(The creator of this piece of software says that the buffer for this pattern is allocated via malloc in the rasterdll). For testing reasons I try the debug version of the rasterdll which displays the calculated pattern without any error. I go on with this debug version to the processing test. There are 2 situations: Sometimes the application crashes when I clear the buffer I got from the rasterdll (where I should store the input line), sometimes the process works as expected and I got a heap crash when I unload OUR dll (which calls rasterdll).
The rasterdll should be stable because it works in the applications that were made by the creator of the rasterdll. I think that the only problem can be an incompatibility. But we have exactly the same versions from visualstudio. I have no idea how to fix this problem. Debugging is nearly impossible and useless in my code. The config-dialog from the rasterdll is called by one line, no chance to make any mistakes. The creator of the rasterdll has no idea too. Hope anybody has some tips.
Many thanX,
Thomas
|
|
|
|
|
hi can anyone help me in making graphs in visual c++. Setting the scale properly.
S@r@
|
|
|
|
|
Hi!
I've made a post similar to this earlier. Due to misunderstanding I've rebuild the Q.
What could possible be wrong when CFtpConnection::GetFile(…) returns 5 (Access is denied). I know the file exists because I've just successfully made a CFtpConnection::PutFile(…). I'm using the same CFtpConnection object.
How could I have right to write to my ftp but no right to read.
Any tips are helpful…
_____________________________
...and justice for all
APe
|
|
|
|
|
Can you 'get' the file manually (i.e., without using code)?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes, and with any (tried two) other FTP-clients with same login. Both of them success.
_____________________________
...and justice for all
APe
|
|
|
|
|
Ok, let's see the relevant code that uses GetFile() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
At first, this Upload function works OK:
<br />
bool CFTP::UploadFileToFolder(const CString &strFile, const CString &strFolder )<br />
{<br />
if( !bConnectionEstablished )<br />
{<br />
AfxMessageBox( "FTP - No server connected." );<br />
return false;<br />
}<br />
<br />
CFileFind Finder;<br />
CString strFileName;
<br />
if( Finder.FindFile( strFile ) )<br />
{<br />
Finder.FindNextFile();<br />
strFileName = Finder.GetFileName();<br />
Finder.Close();<br />
} <br />
<br />
BOOL bUploaded = m_pFtpConnection->PutFile(strFile, strFileName, FTP_TRANSFER_TYPE_BINARY, 1 );<br />
<br />
if( !bUploaded )<br />
Error( "CFTP::UploadFileToFolder(...)" );<br />
<br />
return true;<br />
}<br />
and (using the same CFtpConnection object, m_pFtpConnection)
this funk doesn't work:
<br />
bool CFTP::DownloadFile(const CString &strFromUrl, const CString &strLocalPath)<br />
{<br />
if( !bConnectionEstablished )<br />
{<br />
AfxMessageBox( "FTP - No server connected." );<br />
return false;<br />
}<br />
<br />
return m_pFtpConnection->GetFile( strFromUrl,
strLocalPath,
TRUE,<br />
FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_BINARY, 1);<br />
}<br />
_____________________________
...and justice for all
APe
|
|
|
|
|
hi.
i wuould like to ask if anybody knows that pattern infermation of a cif video file (header, data etc).
also, is it possible to "divide" the cif video file into a series of still images (preferably bitmaps). if it is possible, how am i be able to do it. Our instructor required us to use Visual C++.
thanks in advance...
|
|
|
|
|
Hi,
I am writing an app which requires some CSocket derived objects to be created and processed in seperate threads. All was going well until I made the release build, when I started getting the SOCKET NOTIFICATION SINK errors (I was using CSocket within the CWinThread object).
OK, so after looking for a reason, I discover that it is to do with the CSocket not having an owner window to handle the messages (or some such - still a bit vague about it) and that it's a bit of a bug.
My workaround at the moment is to create a hidden dialog from the thread and put the CSocket derived class in here. This works great, except I get the pesky dialog appearing in the task manager. Since I plan to have several threads running, this is all a bit tacky.
Anyone got any better ideas? or failing that, anyone knwo how I can hide these dialogs without hiding the main window?
BTW using VC++ 6.0
Many Thanks
|
|
|
|
|
I don't think the problem lies within CSocket, because there is absolutely no connection between a CSocket and a window.
It must be something you are doing in your derived class.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
I don't know if this is your problem, but I was having a problem yesterday with using a thread and CSocket. Microsoft has a confirmed bug in which certain members of CAsyncSocket don't get initialized correctly in a second thread (or something like that). The resolution was to put a call to the function I'm going to include below. This function can be a member of your class as long as you also make this static. Also this must be called before EVERY creation of a CSocket object in the second thread if you're doing it like I was in a loop.
void [YourClassName]::SocketThreadInit(void)
{
#ifndef _AFXDLL
#define _AFX_SOCK_THREAD_STATE AFX_MODULE_THREAD_STATE
#define _afxSockThreadState AfxGetModuleThreadState()
_AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;
if (pState->m_pmapSocketHandle == NULL)
pState->m_pmapSocketHandle = new CMapPtrToPtr;
if (pState->m_pmapDeadSockets == NULL)
pState->m_pmapDeadSockets = new CMapPtrToPtr;
if (pState->m_plistSocketNotifications == NULL)
pState->m_plistSocketNotifications = new CPtrList;
#endif
}
[insert witty comment here]
bdiamond
|
|
|
|
|
Thanks, this looks very helpful.
Any idea whether I call this before /after /instead of AfxSocketInit()?
Also, is it OK to declare a CSocket (derivative) as a member and then call it's Create() after running this, or should I just create it on the heap?
Thanks
|
|
|
|
|
In my app, it's called after AfxSocketInit(). I don't think it matters how you declare your CSocket object, as long as you call it before each Create in your new thread. In my app I allocate a CSocket object on the stack because it's only useful for the duration of the function.
[insert witty comment here]
bdiamond
|
|
|
|
|
I cant even get the fuction to run, it barfs at
#ifndef _AFXDLL
So I am at a real loss here. I tried removing this from my preprocessor defs and then I was in real trouble!
Are you actually creating /using your socket from the WinThread? or are you creating a CWnd for it?
Any chnace you can post some code up?
thanks,
|
|
|
|