|
Nothing like a specific question.....
I'm not sure what you want - is your game running in a window, or full screen ? Is it using DirectX or OpenGL, or is it just using standard Windows graphics stuff ?
Assuming you're running in a Window, you can catch OnSetCursor and set your cursor to whatever you want, based on any condition you desire.
Christian
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Hi!.
How I create a short cut (icon) from vc program?.
thx.
|
|
|
|
|
HRESULT CreateIt(LPCSTR pszShortcutFile, LPSTR pszLink,
LPSTR pszDesc)
{
HRESULT hres;
IShellLink *psl;
// Create an IShellLink object and get a pointer to the IShellLink
// interface (returned from CoCreateInstance).
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, (void **)&psl);
if (SUCCEEDED(hres))
{
IPersistFile *ppf;
// Query IShellLink for the IPersistFile interface for
// saving the shortcut in persistent storage.
hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
if (SUCCEEDED(hres))
{
WORD wsz[MAX_PATH]; // buffer for Unicode string
// Set the path to the shortcut target.
hres = psl->SetPath(pszShortcutFile);
if (!SUCCEEDED(hres))
AfxMessageBox("SetPath failed!");
// Set the description of the shortcut.
hres = psl->SetDescription(pszDesc);
if (!SUCCEEDED(hres))
AfxMessageBox("SetDescription failed!");
// Ensure that the string consists of ANSI characters.
MultiByteToWideChar(CP_ACP, 0, pszLink, -1, wsz, MAX_PATH);
// Save the shortcut via the IPersistFile::Save member function.
hres = ppf->Save(wsz, TRUE);
if (!SUCCEEDED(hres))
AfxMessageBox("Save failed!");
// Release the pointer to IPersistFile.
ppf->Release();
}
// Release the pointer to IShellLink.
psl->Release();
}
return hres;
}
Hope this helps
Cheers
Kannan
|
|
|
|
|
Hi!
I when I tried to convert my regular MFC-dll to an extension DLL, I get
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in CommonDLL.obj
mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in CommonDLL.obj
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in CommonDLL.obj; second definition ignored
mfcs42d.lib(dllmodul.obj) : warning LNK4006: __pRawDllMain already defined in CommonDLL.obj; second definition ignored
Creating library Debug/CommonDLL.lib and object Debug/CommonDLL.exp
Debug/CommonDLL.dll : fatal error LNK1169: one or more multiply defined symbols found
I found an MSDN-article, Q148652, about this, but it seems like that text, discussing CRT libraries, isn't applicable in this case.
Any idea's?
|
|
|
|
|
Solved. The cause of the error was that I forgot to remove AFXMANAGESTATE macros.
|
|
|
|
|
Hi,
I need reminder or just a little help to trap the Escape key on the dialog based app to not close the dialog, instead use a button or the supllied menu item.
Thanks.
|
|
|
|
|
You can do that in PretranslateMessage, but I tend to put something at the top of OnCancel like:
if (GetAsyncKeyState(VK_ESCAPE))
return; // or do whatever else I want ESC to do
Christian
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Hello, the codegurus around the world.
Paul DiLascia wrote his article about some similar situation.
Check here.
http://msdn.microsoft.com/msdnmag/issues/0700/c/c0700.asp
Someone asks Paul about "enter" key action to close the dialog box.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Override the OnCancel function like so:
void CYourDlg::OnCancel() {
}
In addition if you would like to catch the enter key you can override OnOK
void CYourDlg::OnOK() {
}
There is always the F1 key too which will search for a .hlp file which can be overridden by:
void CYourApp::WinHelp(DWORD dwData, UINT nCmd) {
}
(Notice this last one was in your App not the Dialog)
Hope this helped.
|
|
|
|
|
Given that it is a dialog box, my way is better - you don't stop the OK/Cancel buttons from working necessarily, but check if the Enter/Escape key is down respectively. That way the button works, but the key does not.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Ok, Your way can be better
|
|
|
|
|
However your method changes the default way that windows works.
I prefer to change the ID of the OK button to something else, then override OnOK to do nothing. This makes it obvious to other programmers what's going on, rather than having to search around.
|
|
|
|
|
Ummm.... changing the default behaviour is the point of the question, isn't it ? I'd suggest that both our methods are similar enough in their impact to another programmer reading our code and in the execution that any discussion of relative merits would be nit picking.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Yes, but the problem with the PreTranslateMessage hack is that it captures the message before the normal handler has a chance to handle it. This can lead to a programmer later adding an OnOK handler and then banging their head against the wall for hours trying to figure out why their code isn't being handled when they press enter.
I make it a point to forget that PreTranslate message exists at all, unless absolutely necessary. If there is another way, I always use that in order to reduce this sort of situation.
|
|
|
|
|
I apologise for obsfucating my method by mentioning PreTranslateMessage, my actual method mentioned does not use it, it just checks to see if the escape key is pressed in OnCancel, so the button still works but the key does not. Similar to check for VK_ENTER in OnOK.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Hello,
I have created a Dialog App and put a Active X Web browser object into the App. I'm having problems with continuously reporting the current url being visited into a edit box. If I create an event to put the info into the edit box this works fine (example: I created a button that runs the code listed below. This posts the information fine). I would like to continuously show the url being displayed. In this article listed below provided by Microsoft it says to put the code listed at the bottom of this page into the "initialization process", this doesn't seem to work. I have put the code into BOOL CBHCBrowserDlg::OnInitDialog()
Microsoft article:
If the current location is an HTML page on the World Wide Web, you can use the IWebBrowser2::get_LocationURL methods to retrieve the full path of the folder or file. If you want this information displayed continuously, add the following code to the initialization process. If you want it displayed only when an event occurs, add the code to an event handler. The following example uses IWebBrowser2::get_LocationURL to retrieve location information and display it in an edit box.
//CWebBrowser2 m_browser - to access the WebBrowser control
//CEdit m_edit - to access the edit control
CString string1;
string1 = m_browser.GetLocationName();
m_edit.SetWindowText(string1);
Any Ideas?
THANKS,
|
|
|
|
|
Hello, the codegurus around the world.;)
First of all, this is my guess.
1) IWebBrowser2 may have some Event function to let us know that now updated html display is completed something like that. So, if this exists, you put get_LocationURL.
2) Try to use Timer or Thread function to always moinitor get_LocationURL.
And if URL is updated from old one, update this URL to edit box.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Place the code
CString string1; string1 = m_browser.GetLocationName(); m_edit.SetWindowText(string1);
in the DocumentComplete Returned Message for your WebBrowser
Regardz
Colin Davies
|
|
|
|
|
Thanks for all the help! I found a event OnDownloadComplete. Everything works great. Thanks..
Rob
|
|
|
|
|
Note:
OnDownloadComplete fires for every object on a web page
eg (jpgs or gifs etc or even frames)
OnDocumentComplete fires for the whole Page.
Regardz
Colin
|
|
|
|
|
I didn't see any OnDocumentComplete event for the Microsoft Web Browser Active X object..
Rob Jones
|
|
|
|
|
Rob
Using The Class Wizard its the 11th event down for a browser control added as a member variable, I just checked and it is there on my VC+ 6.00
Regardz
Colin
|
|
|
|
|
You are correct. I looked there like 5 times before, don't know how I missed it. Weird. Thanks for all your help. I did use that event and added the code to this event. Everything works great!
Thanks again,
Rob Jones
|
|
|
|
|
I have an MFC application that querries an ODBC responder. There is a particular set of messages which is unique to the system which are send to the server through the winsock to register and then to querry the ODBC. Once the application receives the data from the winsock control it is in a string which has to be parsed, right now I got the string separated by the "|" that's the symbol that separates these messages. Then, the information from the ODBC comes in this format, { 1 1 administrator Default {} {} 0 {}}
I am having a hard time parsing the information out of the curly braces. I was thinking of finding the position of the first "{" brace and then finding the position of the last "}" brace, and then extracting the content in between. If any of you guys have any suggestions, methods or any sample code wchich could help me out it would be great, Thanks
|
|
|
|
|
Hello, the codegurus around the world.;)
I'm not sure what is going on.
1) Did you create your own client/server program?
2) If so, server program reads some info from ODBC setting on Window NT server, server program sends this info to client.
3) Did you use CSocket class or WinSock API?
If you use CSocket class, we have a chance to have our class derived from CObject to
set the data structure to make our life easy.
Have a nice day!
-Masaaki Onishi-
|
|
|
|