|
connect() is not a method of communication:public CSocket.
Try this
class communication :publice CSocket
{
...
...
private:
CSocket* m_pTheSocket;
public:
bool connect()
{
m_pTheSocket->Create()
...
...
}
};
Also, here is a nice article for you.
http://tangentsoft.net/wskfaq/articles/csocket.html
|
|
|
|
|
|
I have small CHtmlView - based application. If opens a page with Java or JavaScript error, the debugger (InterDev) pops up automatically. I believe In MSIE Internet Options / Advances "Disable script debugging" is checked. Is there a way to prevent it from doing so ?
|
|
|
|
|
Can anyone please explain me how to change font in CEdit.
I tried with CWnd::SetFont() but it doesn't work.
|
|
|
|
|
You need to ensure that the font exists for the life of the CEdit control. Suppose you're changing the font in the OnInitDialog() handler for your class:
BOOL MyDialog::OnInitDialog()
{
CFont myFont;
myFont.CreatePointFont(120,"Arial");
myEdit.SetFont(&myFont);
} This won't work, because as soon as the OnInitDialog function exits, the myFont variable is destroyed, which destroys the font and the edit control reverts to using the standard font.
You fix this by making the myFont value a member of the dialog:
class MyDialog : public CDialog
{
CFont myFont;
};
BOOL MyDialog::OnInitDialog()
{
myFont.CreatePointFont(120,"Arial");
myEdit.SetFont(&myFont);
} Since the myFont variable is a member of the dialog class, it exists for as long as the dialog object, and therefore the edit control.
Software Zen: delete this;
|
|
|
|
|
|
I do apologize if this question has been asked a thousand fold but here I go again with it. Is it possible to compile a VC++6.0 project in VC++ .NET? After some looking I'm thinking .NET is a whole new framework and that it I wrote my project in VC++ 6 than it stays as a VC++ 6 unless I rewrite it? Is that a logical assumption or is there a way to convert it over painlessly.
thanks!
|
|
|
|
|
Yes, you can compile your VS6 project just fine in VS.NET. When you open your old project, you'll be asked to convert it into a VS.NET project. A common mistake for people is to think that VS.NET is .NET only, but you can create just normal C++ programs with it, just like in VS6.
Be sure that everything is compatible with VS.NET though. The company I work for uses OmniORB 3.xx for example, and that won't compile with VS.NET. But normally, there shouldn't be any problems.
|
|
|
|
|
VC.Net will convert your 'project' files. Generally if your source code is conservative then it will just compile with the new compiler and libraries. If you've exploited undocumented features of ATL or MFC then you may have to do some tweaking. Similarly if your use of the standard library was somewhat non-standard then VC.Net may complain.
IME it generally works well. Take care to preserve your original files.
Paul
|
|
|
|
|
Thank you very much for the replies. I'm sorry if I am slow on the uptake but I'm simply looking for a little help possibly a lead on how or perhaps what is happening with my project. Basically it is not compiling and it is erroring out on my ADO class.
I tried looking online here and cannot find source that could help me figure out how to solve some of the errors that are coming up.
For example. the following line tells me adExecuteNoRecords is undeclared. I used MSDN and discovered this enumtype doesn't exist but replaced it what I found on MSDN and I still get this error. Any ideas about it?
m_pConnection->Execute(_bstr_t(lpstrExec), &vRecords, adExecuteNoRecords);<br />
Another is this where it says GetString is undeclared. I haven't a clue what I am supposted to use then.
<br />
varOutput = m_pRecordset->GetString(adClipString, numRows, varCols, varRows, varNull);<br />
The same here where Save is not defined.
<br />
hr = m_pRecordset->Save(lpstrXMLFile, adPersistXML);<br />
Basically I'm a touch worried. These compiled fine under VC++ unless .NET added these lines. I can't see why it would do that. Basically, can anyone lend a hand and help me to where I could go to get some answers on things to look for or perhaps the ADO libraries changed for .NET or perhaps there is something here completely over my head.
Thanks for the tip on .NET though. It helps in that I don't have to worry about going back and forth between vc6 and vcNET.
|
|
|
|
|
Your problem isn't VC.Net, it's ADO.
You have to find where in your source code the ADO stuff is declared, I suppose this could be either via a #include or a #import and work from there.
Paul
|
|
|
|
|
hi all,
have a question which i couldnt find an answer after searching for several days now.
Well everyone knows the "show desktop" button. what i need to do is to intercept its action and do soemthing else instead of the minimizetion of windows(or restoring). well from what i have read and found i gather that the icon calls shell.IDispatch4.minimizeall or undominimize all.
Is there any option to intercept it before its doing this shell line? and by that i mean does anyone knows what message its sending ? or any other method of interception u have will be more then welcome .
thanks in advanced,
Barak
|
|
|
|
|
OOPS , first message/question i ever send here , so i'm a noob when it comes to asking here ...
anyways I'm talking on Visual C++ programing enviorment.
sorry for leaving that detail out
|
|
|
|
|
One solution that I've come up with is subclassing. You can subclass the Quick Launch window, which is in actual a toolbar control (i.e. its window class is ToolbarWindow32 ), intercept the windows messages, and do whatever you want to do.
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
I realize what's going on now, but I can't fix it. Take a look at this an it'll explain my situation.
#define VERY_LARGE_NUM 9999...
main()
{
double dummy[VERY_LARGE_NUM]
for(i...
{
//create a few threads
createThread....
}
....
}
The program bombs out when I try this because the dummy array allocates more than the 1 meg. Hence, I change the stack reserve and commit to a large value. This fixes the bombing out problem, but creates a new one. The create thread function will only create X num of threads while I want Y num of threads. I tried setting the stack param in the create thread func but it did nothing for me. What can be done. The /3GB flag is not an option because the target machine's OS does not support it.
|
|
|
|
|
Other than spinning a new process. Is there a soluation.
|
|
|
|
|
Risking asking a stupid question, have you considered allocating it on the heap (double *p = new double[BIGNUMBER]), not on the stack?
If for some strange reason you need to allocate it on the stack, the CreateThread API function allows you to specify a bigger stack size.
I see dumb people
|
|
|
|
|
The example was simply to demonstrate the situation. The real app uses all these classes. The original design called for them to be globals to make communicating between all the threads that we created. Hence, we, in essensce, have a main with a ton of classes that spin up a ton of threads. Your create thread suggestion leads me to my 2nd problem. I specified a bigger stack inside my project setting (Stack reserve and Stack commit). This move fixed my stack over-flow problem when running the app. However, I can't seem to call CreateThread pass a certain number of threads. I'm aware of the stack size parameter inside the API call, but it seems not to solve the problem. Does the stack reserve/commit set the stack size for all threads and the main process?
|
|
|
|
|
I don't understand why you're allocating such a large array from the stack. Why not 'new' and 'delete' or 'std::vector<double>'?
How many threads are a 'ton'?
Why so many threads? In general if your threads are ready to run then there's no point in having more than the number of CPUs your machine has. If they're not ready to run, they're waiting for input, then you still don't want more than a relatively small number (let's say less than 25) due to the overhead of thread creation, context switching and stack usage(!). In this case you should investigate a thread pool and overlapped IO.
Paul
|
|
|
|
|
i have the following problem, if i declare a variable in a local function and then assign a value in a try block under release min dependency the value is corrupt or the same as it was before the try block upon entering the catch. Please what am i doing wrong?? The code is below:
STDMETHODIMP CCMI_BioWrapper::QueryTemplate(BSTR Badge,BSTR *Response)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
int nRetCode;
CString strVal;
nRetCode = 0;
try
{
nRetCode = 99;
return S_OK;
}
catch(...)
{
// I would expect nRetCode to be 99 here
// however it is always 0, unless i do a debug build
// then it always works
strVal.Format("Q0 %d",nRetCode);
*Response = strVal.AllocSysString();
return S_OK;
}
}
|
|
|
|
|
how can i check the status of a URL, like http://www.codeproject.com
is active / down , Winsock or any other ..????
I want to change Myself..Can u help me?
|
|
|
|
|
How about InternetCheckConnection() ?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Great..Thankyou
I want to change Myself..Can u help me?
|
|
|
|
|
You can look at this example prog: [^]
onwards and upwards...
|
|
|
|
|
I need the API, not the exes..
I want to change Myself..Can u help me?
|
|
|
|