|
See my other reply; once again you are trying to use pView without initialising it to point to anything. I would suggest some further study in classes and objects.
It's time for a new signature.
|
|
|
|
|
Your code:
CMyFormView *pView = NULL;
CListCtrl* pmyListCtrl = &pView->m_list_1098;
will not work. You have set pView to NULL and then tried to use it as a pointer to a list control object. You may need to review the relationship between your classes.
It's time for a new signature.
|
|
|
|
|
Dear experts,
I want to design a graphical editor using Irrlicht engine!
my software is divided in to two parts. one user interface and second is a window which Irrlicht uses to draw
on it!
i want to use separate threads to avoid from interfering of GUI in Irrlicht drawing loop! now i need to know which kind of thread i should use for each one!(Worker and UI Threads)
i have used MFC platform!
void Irrlicht_Main_Process()
{
while(true)
{
Draw anythings here
}
return true;
}
Best regards
|
|
|
|
|
Creating a Worker Thread:
A worker thread is commonly used to handle backgrounds tasks
that the you shouldn't have to wait to continue using your application.
Creating a secondary thread is pretty easy task. There are only two steps:
Step 1. Create a function which will be executed by secondary thread.
This function has your code which suppose to executed in secondary thread.
UINT ProcName(LPVOID param)
{
{
Do Something
}
return 0;
}
Step 2. Create thread by calling MFC function AfxBeginThread.
AfxBeginThread( ProcName, param, priority );
This thread remains active as long as thread's function is executing.
When thread function exits, the thread is destroyed.
You can set thread priorities according to your requirement.
Multithreading using MFC
http://www.dotnetheaven.com/Uploadfile/mahesh/MultithreadingUsingMFC05212005025727AM/MultithreadingUsingMFC.aspx
MFC User Interface Threads
http://www.codersource.net/MFC/MFCAdvanced/MFCUserInterfaceThreads.aspx
A multithreaded, OpenGL-enabled application
http://www.codeproject.com/KB/openGL/GLBase.aspx?msg=1865649
...
|
|
|
|
|
Duplicate posting, already in QA.
|
|
|
|
|
Michel Godfroid wrote: Duplicate posting, already in QA.
How many forums are you watching
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
All of them, I was bored yesterday. I draw the line at Perl
|
|
|
|
|
WAVEFORMATEX in_wfx;
in_wfx.wFormatTag = WAVE_FORMAT_PCM;
in_wfx.nChannels =1;
in_wfx.nSamplesPerSec =8000;
in_wfx.nAvgBytesPerSec =16000;
in_wfx.nBlockAlign =2;
in_wfx.wBitsPerSample =16;
in_wfx.cbSize = 0;
how to convert above form to following form?
WAVEFORMATEX out_wfx;
out_wfx.wFormatTag = WAVE_FORMAT_PCM;
out_wfx.nChannels =1;
out_wfx.nSamplesPerSec =8000;
out_wfx.nAvgBytesPerSec =8000;
out_wfx.nBlockAlign =1;
out_wfx.wBitsPerSample =8;
out_wfx.cbSize = 0;
|
|
|
|
|
| how to convert above form to following form?
|
| WAVEFORMATEX in_wfx;
| in_wfx.wFormatTag = WAVE_FORMAT_PCM;
| in_wfx.nChannels =1;
| in_wfx.nSamplesPerSec =8000;
| in_wfx.nAvgBytesPerSec =16000;
| in_wfx.nBlockAlign =2;
| in_wfx.wBitsPerSample =16;
| in_wfx.cbSize = 0;
|
|
|
| WAVEFORMATEX out_wfx;
| out_wfx.wFormatTag = WAVE_FORMAT_PCM;
| out_wfx.nChannels =1;
| out_wfx.nSamplesPerSec =8000;
| out_wfx.nAvgBytesPerSec =8000;
| out_wfx.nBlockAlign =1;
| out_wfx.wBitsPerSample =8;
| out_wfx.cbSize = 0;
|
The nAvgBytesPerSec and nBlockAlign should be calculated:
out_wfx.nBlockAlign = out_wfx.nChannels * out_wfx.wBitsPerSample / 8;
out_wfx.AvgBytesPerSec = out_wfx.nBlockAlign * out_wfx.nSamplesPerSec;
out_wfx.nAvgBytesPerSec = out_wfx.nSamplesPerSec * out_wfx.nBlockAlign;
...
|
|
|
|
|
Currently using CreateFile and WriteFile functions.
I'm using
LARGE_INTEGER Position = Download->BytesDownloaded;
SetFilePointerEx(File, Position, NULL, FILE_END);
Keeps returning unable to convert _int64 to LARGE_INTEGER.
I read the structure of LARGE_INTEGER defined in WinNT.h.
Their is a LONGLONG declaration in it, but can't use it.
|
|
|
|
|
Fareed Rizkalla wrote: LARGE_INTEGER Position = Download->BytesDownloaded;
I suspect the error is there (BytesDownloaded) is long long or __int64.
Why pass the position anyway? If you are appending, just move the file pointer to the end of the file: SetFilePointer(File, 0, NULL, FILE_END);
|
|
|
|
|
I was using CFile in my project, although I resented everything MFC.
I rewrote the parts that were responsible to file output with WriteFile.
All of a sudden it stopped working without me changing anything in the code. When I wrote the code it was working now all of sudden it doesn't want to do what it's supposed to do.
HANDLE File;
File = CreateFile(LocalPathPFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS | OPEN_EXISTING,
FILE_ATTRIBUTE_ARCHIVE | FILE_FLAG_WRITE_THROUGH, NULL);
WriteFile(File, Data, (DWORD)BytesReceived, NULL, NULL);
CloseHandle(File);
|
|
|
|
|
A lot of Windows functions provide error information; ignoring that is irresponsible and leads to mysteries such as the one you are facing now. Add proper error checking and handling to your code, and do it everywhere. Read the MSDN documentation on every Windows function you are using, and use GetLastError the way it should.
|
|
|
|
|
Beat me to it by 2 minutes.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh R Subramanian wrote: Beat me to it by 2 minutes.
2 minutes? that is an eternity, it is more than 1 billion ticks. Are you having a slow day?
|
|
|
|
|
Fareed Rizkalla wrote: OPEN_ALWAYS | OPEN_EXISTING
You instruct the CreateFile call to always open an existing file (and NEVER create one). Chances are that the file is deleted and the call to CreateFile is failing.
Also, API calls return a value for a reason - they let you know if something failed. Please check the documentation for these functions and check the return values (you may have to call GetLastError to find out what exactly went wrong).
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hy.Have anybody know a CSMTP client class , or an tutorial about to how to construct that ?
|
|
|
|
|
Jakub Piwowarczyk has written an interesting codeproject article with a class named CSMTP. The link to it is below.
SMTP Client[^]
...
|
|
|
|
|
Thanks , I try it , but do not send attach file ( attach file size is 0 ).
modified on Saturday, May 1, 2010 1:54 PM
|
|
|
|
|
Ok, you wrote that the program worked, you got no errors, an email was sent but not the attachment. ( attached file size is 0 ).
If you have problems sending an email, use Visual Studio's debugger and analyse the conversation
between your SMTP server and the client; perhaps, your server needs a different kind of authentication or doesn't need it at all.
|
|
|
|
|
You might have right , for test I use my gmail count , smtp.gmail.com , I will work around ... thanks .
|
|
|
|
|
I am having a tree on a dialog. I can select a node by clicking it; it highlights that node. But when I click in the textbox (or any other control in the dialog) then the selected node of tree does not remain in highlight state. It looks like nobody has clicked on any node. But when I click back on TreeCtrl then the selected node again get highlight.
So how to preserve the highlighted state or how to change selected node's backColor while I click on any other node and leave tree.
Thanks,
Rahul
|
|
|
|
|
|
Thanks Gary that worked. But backcolor is light Gray. So how can I change it to light blue.
|
|
|
|
|
These are the standard Windows colors. In order to override the colors in your control, you will probably need to implement custom drawing[^], which can be a little involved.
|
|
|
|