|
Thankyou, thankyou, thankyou. It worked at last! I did hit one further snag, a warning came up about MSVCRT.lib conflicting with some other lib every time I compiled, so I took out the _MBCS part of the Settings > C++ > Preprocessor definitions and it removed the error and everything compiled. I'm not sure if this is the best way to go about it though, what do you reckon? Also how come it works when you enter this code in a simple win32 app just after creation? I didn't have to change the code generation stuff at all then? seems a bit strange to me. Anyway, I thankyou for the time and effort you spent replying to my problem, much appreciated.
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
First, when you post code you click the little checkbox at the bottom that says "Display this message as-is (no HTML)" to get your brackets to appear (though your signature will now look weird). Alternatively, you can simply use the HTML equivelents "& lt;" and "& gt;" (without spaces) for less than and greater than.
Second, you probably don't want to be using fstream.h, these are the old deprecrated iostream libraries. The new libraries are simply:
#include <fstream> // Note: no .h
Third, some functions have dependancy on the multithreaded library, and as such require a multithreaded version of it. You're linking with the single threaded version. Change that in your project settings on the C++ tab.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
Thankyou, thankyou and more thankyou's. Absolutely correct. Would you mind reading my reply above, cos i hit one further snag which i'm not sure I've handled "properly" according to convention. Anyway, thanks for your time replying to my problem, I am extremely pleased to have got over this horrible link error. I must admit I find it strange because if you put that code in straight from scratch on a simple win32 project it works! without having to change the code generation to multi threaded? Oh btw, thanks for you advice on the < fstream > < fstream.h > issue , I was going to use fstream but I think out of boredom and complete frustration I was trying anything to get the bugger to work .
Many Thanks for you time and help
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
I want to draw the caption area by myself,but the system will draw it when needed.How can I do?
thank you!
Don't look at me in that way!
|
|
|
|
|
http://www.codeproject.com/gdi/customcaption.asp
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
thanks!
but can you give me easy way to stop windows draw the titlebar.
the code of customcaption is so long!
Don't look at me in that way!
|
|
|
|
|
Do I have always to call the CException::Delete method to make sure that it is always deleted?
Best regards,
Alexandru Savescu
|
|
|
|
|
If you get a reference to an CException object you should call Delete() to prevent memory loss.
Vezi ca e important cum construiesti obiectul ala
CException( BOOL b_AutoDelete );
... asa pe romaneste
Bye,
Orbital^
...the night is long ... but not long enought to do some real coding ...
|
|
|
|
|
I think we should post in English only.
I catch a pointer to a CDBException that I didn't create myself, it was thrown by MFC like this:
try
{
}
catch (CDBException* e)
{
}
Best regards,
Alexandru Savescu
|
|
|
|
|
You have to always delete exception, when you catch it as pointer to it.
|
|
|
|
|
Martin Ziacek wrote:
You have to always delete exception, when you catch it as pointer to it.
I thought so. Thanks!
Best regards,
Alexandru Savescu
|
|
|
|
|
1.I want to create two menus in the menubar,and which have different handles.
2.Can i prevent redrawing menubar?I don't want it redraw so much often.
|
|
|
|
|
Hi,
I would like dynamically change a caption in my SDI application (CFrame). I'm trying this (in OnInitialUpdate):
m_pMainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
m_pMainFrame->SetWindowText("Some caption");
But it still go bad.
Can anybody tell me something about this?
Thanks
defox
|
|
|
|
|
You can put this your CMainframe class in your OnCreate .
SetWindowText("some caption");
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Or you could try that. lol
Mazdak wrote:
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
I'v been a big Metallica fan since Kill'em All days.
|
|
|
|
|
OnInitialUpdate is a virtual function of CView and CView doesn't know who m_pMainFrame is. Here is something you can try though I still don't think it will change the caption (I'm taking it as the titlebar).
<br />
CMainFrame * pFWnd = (CMainFrame *)AfxGetMainWnd();<br />
pFWnd->SetWindowText("Some Caption");<br />
If it was me, I would add a function to the CDocument class or any class you want to change the caption to what ever you liked. Off the top of my head like so...
int ChangeCaption(CString string)
{
CMainFrame * pFWnd = (CMainFrame *)AfxGetMainWnd();
pFWnd->SetWindowText(string);
}
and use the int to check if any error occured. SetWindowText should return a value - Off my head I can't remember what though.
Cheers
Jay Beckert
|
|
|
|
|
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInst,
HINSTANCE hPrevInst,
LPSTR szCmdLine,
int nCmdShow)
{
HWND hWnd;
WNDPROC WndProc;
(VOID)hPrevInst;
(VOID)szCmdLine;
(VOID)nCmdShow;
hWnd=CreateWindowEx(0,"EDIT","Test",WS_POPUP | WS_BORDER | WS_VISIBLE,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
NULL,(HMENU)NULL,hInst,NULL);
if (hWnd)
{
WndProc=(WNDPROC)GetWindowLongPtr(hWnd,GWLP_WNDPROC);
SetWindowLongPtr(hWnd,GWLP_WNDPROC,(LONG_PTR)WndProc);
}
DestroyWindow(hWnd);
}
I have been updating some old code to allow for 64bit compatibilty I followed an article on MSDN which explained the correct way to convert from GetWindowLong() to GetWindowLongPtr() but I am getting the following compiler warnings.
GetWindowLongPtr - c:\temp\test\test.c(18) : warning C4312: 'type cast' : conversion from 'LONG' to 'WNDPROC' of greater size
SetWindowLongPtr - c:\temp\test\test.c(19) : warning C4244: 'function' : conversion from 'LONG_PTR' to 'LONG', possible loss of data
Can anybody please help me out?
Steve.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Is a LONG 64 bits in Win64 (and in the extension, at the point you try to use it)? A little printf-debugging with sizeof can surely say if it's your code, or if MS once again messed up. My bet is on the latter.
|
|
|
|
|
Hi, in a dialog control , i have 3 sliders, each of them is to do some specific task. I'm aware that everytime i move the slider it calls the message called WM_HSCROLL , and WM_VSCROLL for vertical one. But the problem is how do i identify these controls in the OnHscroll handler? There is a parameter called CScrollBar pointer is passed in too but how do u used this?
Thanks
|
|
|
|
|
tcuong wrote:
But the problem is how do i identify these controls in the OnHscroll handler?
If you use VC6 with classwizard you can define controller for them and identify them whenever you want in your dialog class.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
how do u do so, i've looked at the classwizard for those control but there r only 3 message which is OUTOFMEMORY, RELEASEDCAPTURE and CUSTOMDRAW. Thanks
|
|
|
|
|
Go to classwizard.(press CTRL+W) Go to Member Variable tab.
In the Class name box, click the CYourclass .
In the Control IDs box, click IDC_YOURID .
In the Category box change Value and then enter name of your control and click ok.With that name you can use your controler.Understand?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Hi !
I have the following question : I have 2 machines A and B in the same workgroup and I have a DCOM server at machine A . I'm logging at A and B with different passwords , the probelm is that CoCreateInstanceEx succeds at B but I cannot call any methods of the created DCOM object .(security error 0x80070005)
How could I configure the DCOM sever and Client to work?
I tried DCOMCNFG to allow Everyone to access and launch but it's still not working
Thanks
Jancsi
xxx
|
|
|
|
|
I use a component that returns errors using the ISupportErrorInfo. I create this component inside another component and I can not access the error Description using the code below:
CoInitialize(NULL);
if (FAILED(CoCreateInstance(CLSID_AppSrv, NULL, CLSCTX_ALL,
IID_IAppSrv, (void**)&pAppSrv)))
{
::SysFreeString(bstrInCall);
return;
}
hResult = pAppSrv->DispatchService3(bstrInCall , &vResponse);
if (hResult == S_OK)
*szXMLResponse = vResponse.bstrVal;
else
{
HRESULT hr=S_OK;
IErrorInfo *err;
BSTR str;
hr = GetErrorInfo(0, &err);
if (FAILED(hr))
{
*szXMLResponse = "<error>Unable To Retrieve Error Message";
return;
}
hr = err->GetDescription(&str);
if (SUCCEEDED(hr))
{
CString szTemp;
szTemp = "<error>003 <description>";
szTemp += str;
szTemp += "";
SysFreeString(str);
*szXMLResponse = szTemp;
}
err->Release();
}
Note that GetErrorInfo never fails but GetDescription always fails. Note that this happens when both the components are installed into 2 different packages in the COM+. Also the threading model of the component that produces the error is Apartment while the threading model of the component that fails to access the error is Neutral.
Spiros Prantalos
|
|
|
|
|
What do you do on server side?
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
|
|
|
|