|
I had two classes on the same dialog and i've been using the wrong one.
Sorry!
rechi
|
|
|
|
|
I am writing an app that uses the CAsyncSocket in order to talk to a telnet session and automated some tasks.
Here is the problem.
If I isolate the main functions of a connection into its seperate parts, and run those individually from a button, everything is fine, however, if they are chained within a single function, it fails. ie) connect, send password, run a router command.
The socket class appears to be running in its own thread. I have overridden all of the relevent virtual functions (ie OnConnect, OnReceive, etc. - In the socket class) but I am unable and unsure how to get a message to the dialog as to when the receive is finished. I have tried setting flags and just looping in the dialog code, but the app just hangs.
Help?
Thanks
|
|
|
|
|
sorry no idea.
a) try some verbose debugging, see if packages are as expected (remember TCP/IP packets can be fragmented or concenated when transfared).
b) do everything within one thread context (here I mean GUI and your socket class). If not, CAsyncSockets will suprise you with fine asserts (in Debug version). *g*
c) CAsyncSocket has a design weakness with DNS, you need to use IPs not hostnames. If you don't use IPs, you are not "async" - I mean the name resolution might block the call for a specific time.
Hope it helps.
|
|
|
|
|
I have a dialog based MFC app with a CTreeCtrl. I´d like to change the shape of hte cursor in that app. I handle the WM_SETCURSOR message from the main dialog, and I SetCursor() But when the cursor pass on the tree its shape switches to the usual arrow. So I have my new cursor only on the window bits where there are no control, and i´d like to have it everywhere in the window. Any suggestion ?
Thanks,
~RaGE();
|
|
|
|
|
you'll probably have to handle the cursor shape from the tree control itself. derive a class from CTreeCtrl and handle it just like you are doing in your app.
-c
Being just contaminates the void. --Robyn Hitchcock
|
|
|
|
|
I read that to enable/disable a menu item you do the following:
ON_UPDATE_COMMAND_UI(ID_FOO, OnUpdateFoo)
void CMainFrame::OnUpdateFoo(CCmdUI* pCmdUI)
{
pCmdUI->Enable(pObj->GetFoo());
}
Thats okay if I'm enabling or disabling the menu item that got clicked. What if I want to disable say the file/new menu from another menu item2 (say in response to some information that item2 receives)?
AM i missing something?
Thanks,
ns
|
|
|
|
|
I read that if the menu item doesnt have any handler it comes up disabled. Thats true. I added a COMMAND_UI_UPDATE handler and the menu item came up enabled! So I did this:
void CFormViewMDIDoc::OnUpdateEditDisabled(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(FALSE);
}
and it comes up disabled.
Now how to I get it enabled again? If I dont have access to the pCmDUI pointer to this menu item (which comes in from OnUpdateEditDisabled(CCmdUI* pCmdUI) then I cant enable it from some random event.Correct? If the menu item is disabled, then it cant respond to clicking on it, so the OnUpdateEditDisabled(CCmdUI* pCmdUI) wont fire.....
Appreciate suggestions,
ns
|
|
|
|
|
I tried:
void CFormViewMDIDoc::OnUpdateEditDisabled(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
// pCmdUI->Enable(FALSE);
// pCmdUI->SetCheck(m_checked);
pCmdUI->Enable(m_checked);
}
void CFormViewMDIDoc::OnEditDisabled()
{
if(m_checked)
{
m_checked = FALSE;}
else
{m_checked = TRUE;}
}
which works great for setcheck, but with enable, once you disable it its forever disabled.....
Helpppp!
|
|
|
|
|
I had to do more reading and it finally dawned on me that we have to check the state of some flag that gets set in response to some action somewhere, and consequently enable/disables in the UI Update commmand!!!
|
|
|
|
|
I am after a graphing component with which I can plot a 3d surface, the mschart component allows all graphs except a surface plot.
any ideas?
|
|
|
|
|
Hi all,
I have MS Visual C++ .NET standard installed on my PC.
I created a MFC dialog-based application with the help of wizard.
During compliation I get the following error:
error:C2065: 'ID_FILE_EXIT': undeclared identifier c:\Program\...\afxmsg_.h
error:C2065: 'ID_STUFF_GO': undeclared identifier c:\Program\...\afxmsg_.h
error:C2065: 'hIcon': undeclared identifier c:\Program\...\afxmsg_.h
error:C2065: 'hIconSm': undeclared identifier c:\Program\...\afxmsg_.h
Why I get these errors, have I missed some path info?
Any kind of help in this regard
regards
/rsasalm
|
|
|
|
|
Help!
Sometimes, in the middle of a project, the classview pane suddenly loses a class. I had a class called CLogin, and it vanished! I reloaded etc but its not there! SO I have to create a new class now. THing is, the cpp files etc are in the project. I just have no way of accessing the class in the pane to add custom member variables and functions!!!
What is happening here?
Thanks!
ns
|
|
|
|
|
If class view starts acting up, exit Visual Studio and delete the .ncb file. If you can, get out of the habit of using classview. Sometimes it is more trouble than it is worth.
Michael
Logic, my dear Zoe, merely enables one to be wrong with authority. - The Doctor
|
|
|
|
|
Totally agree with Michael, classview is a pain. I always use fileview cos I think its easier and less fiddly.
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Hey! Thanks a bunch! Now I can see all my lost classes again. I was so afraid I'd have to create new classes sporadically!
Is this odd - If the class isnt in the class wizard, VS says the class is not identified! Even though the cpp, h files are in the project!!
How would I add a member variable like int m_something, and a member function - thats what we get to be able to do from the context menu when clicked on the class in the class view pane. Do you just go and put them in manually in the h file and cpp file? But see, if the class view pane gets rid of it, the project wont acknowledge the class even if I put variables and functions in manually.
Thanks again,
ns
|
|
|
|
|
You do go and put all your functions and member variables in manually. I have only used MFC a little bit, and didn't like it too much. I remember a quote about Visual Basic, from a book I once read, which I think applies so much to MFC, it has... "Ten thousand spoons when all you need is a knife", which was also, ironically, one of the lyrics in Alanis Morisettes song Ironic, though I don't think she was on about VB or MFC . It reminds me of the horrible days when I was being taught to program in an horribly constrained environment called Delphi, urrghh. I also seem to remember something my mum kept telling me about "If you want a good job done, do it yourself", although she wasn't on about programming either I still think you can't go wrong with that advice (IMO).
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
|
Don't forget that the workspace doesn't automatically get saved, so if you add a new class, and then it crashes, the new class won't be added to the project when you re-start visual studio. The fix is just to add the files back in to the project manually, and always remember to save your workspace every time you add new files or classes
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Use "file view" to open the header file of that missing class("Login.h" in your case), produce some error, for example, type a character somewhere, then hit "F7" to build your project, of course you'll get a compile error, good, then remove the error from that header file, build it again. Then go back to class view and that class is back!
In short, once some changes has been made to the class header file, VC 6 will re-recognize it.
|
|
|
|
|
Could you not just go to the Build menu and click "Rebuild all" (having not made any deliberate errors)? Just a thought. Of course this method would only work if the ".h" and ".cpp" files have been added to the workspace project (if not go to the Project menu and "Add->Files...".
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
some changes MUST be made to the header file, that's my personal experience of course.
|
|
|
|
|
Hello, I urgently need help getting Direct3D working, or at least find out where I am going wrong, so please read on. I am willing to send the full source code of my app to anyone willing and capable of maybe solving the problem. I have managed to setup DirectDraw, Direct3D the Primary Surface with one BackBuffer and the Direct3DDevice in one function (where I also set the Direct3DDevice viewport). I can load an image and blt it to the backbuffer and flip it, no problem. However, if I try and draw a simple triangle with gouraud shading with the following code:
HRESULT CDarkSoldier::Render()
{
if (SUCCEEDED(m_pD3DDevice->BeginScene()))
{
D3DTLVERTEX v[3];
v[0] = D3DTLVERTEX(D3DVECTOR(160,50,0), 1, D3DRGB(1,0,0), D3DRGB(0,0,0), 0, 0);
v[1] = D3DTLVERTEX(D3DVECTOR(440,200,0), 1, D3DRGB(0,1,0), D3DRGB(0,0,0), 0, 0);
v[2] = D3DTLVERTEX(D3DVECTOR(160,550,0), 1, D3DRGB(0,0,1), D3DRGB(0,0,0), 0, 0);
m_m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DVT_TLVERTEX, (LPVOID)v, 3, NULL);
return m_pD3DDevice->EndScene();
}
return DDERR_INVALIDPARAMS;
}
I get nothing, just a blank screen. This code is executed whenever there is no windows message pending (i.e. when the system is idle - and it is I have tested it). I have tried flipping the primary surface after this code, but nothing. Also, I have tried using m_pD3Device->Clear() to clear to another colour without success. Why is this happening? Is there something I MUST do before the Direct3DDevice will work? I receive no errors during setup, or during the app at all, come to think about it. I create the Direct3DDevice using m_pD3D->CreateDevice(pGUID, BackBuffer, &m_pD3DDevice); I have DirectX8.1 runtime and DirectX7 SDK. I have tested DirectX7 and DirectX8 using the system diagnostic indicator, and both are fine. So there MUST be something. Please...just highlight some areas or pitfalls where I might be falling down on. I am desperate to draw a friggin triangle...it shouldn't be this difficult.
P.S. Not sure if its linked, but immediately after window creation and d3d initialisation if I blt a surface to the back buffer and flip it, the image comes up. If I blt it to the primary surface, it never comes up no matter how many times I flip it (its blank). However, I can get this code to work provided it is located somewhere in the WindowProc message processing loop, but not before it enters...is that strange or what?
Thanks to all who read and reply.
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
I wish I could swear at this point. I have AT LAST found the problem of ALL problems, and I managed to do it myself (where is the smiley for pat yourself on the back??). Do you want to know why my D3DDevice structure wasn't drawing a triangle on the screen? Well I'm gonna tell you anyway. You wil note my code in the previous message (above) where it says m_pD3DDevice->DrawPrimitive(...) ok? See the flag D3DVT_TLVERTEX? yeah? well change it to D3DFVF_TLVERTEX and the b*****d thing works! I have wasted 4 or 5 days on this crappy problem and if there is ever an excuse NOT to use Direct3D over OpenGL, that is it! That flag worked in v6, but not in v7, watch out for more nasty problems I run into on this very web site.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
I have an ATL dialog box, but when clicking OK, Cancel, or the X on the window border, the window does not close.
I have implemented the dialog box using CDialogImpl template class.
Tx
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Hi,
I have an awefull problem with casting floats to doubles, for example:
float f = 0.2f;
double d = (double)f;
results in d == 0.20000000232323442 or other garbage after the precision of float.
I'll be glad to any ideas other than fitting the result to float precision since float precision might be change between platforms. (theoreticly speaking).
thanks,
BishGada.
|
|
|
|
|