|
Hi Cédric Moonen,
Thank you u very much for the reply.
I have 3 dialog window, in which I am accepting data from the user in the 2nd dialog window and when the user press on start process ,it should display 3rd window and start processing immediately after dialog load so in the 3rd dialog window user has option or no need to enter any data.
Since I have to 2 process Dialog load and also process I have used the Thread so that dialog loads and also processing also takes place ..
For processing of data I need to access those values can u please tell me is there any way to do that …
I want both the values in the thread function in the loc field can u help me with this…
|
|
|
|
|
UINT WorkerThreadProc(LPVOID Param)
You can access to the parameters through Param variable, if you are not still using that:
interpret it as a pointer to the dialog that contains the variable members, and then reach the values .
If you are using Param in another way you could create a struct where you can store every information that needs to be passed to the thread.
But, be carefull : if you create a local (like in OnInitistance )instance of the structure, that will be destroyed when the function ends, i.e. before that the thread ends,....so goodby to the paramenters
You can solve this problem using a memeber variable into the first dialog or with dynamical memory allocation (but others problems cames to free the memory ).
hope be clear
|
|
|
|
|
Hi _Russell_,
Thanks for the wondeful reply and thanks a lot for giveing lot of information.
I am very much new to VC++ and threds ,i just learned threads by some sample notes i am really very new to it ...
can u please tell me how i have access the values in the thread without any problem can u please tell me with some examples or some code please..
BOOL CStatusDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_ctrlSNAME.SetWindowText(sfile);
m_ctrlSLOCATION.SetWindowText(slocation);
CString str;
HANDLE hr;
hr = CreateThread(NULL,0,(unsigned long (__stdcall *)(void *))WorkerThreadProc,this,0,0);
return TRUE;
}
--------------------------------------------------------------
UINT WorkerThreadProc(LPVOID Param)
{
CStatusDlg status;
//CString loc = status.slocation + status.sfile;
char * d =(char *) (LPCTSTR) loc;
return true;
}
------------------------------------------------------------
please give me some solution so that i can access values from InitDialog and ican use them in Thread.
will be watiing for your responce...
|
|
|
|
|
Hi,
I got the solutiion ..Thanks a lot for all the help ....
-- modified at 3:20 Thursday 18th May, 2006
|
|
|
|
|
vinaycool wrote: hr = CreateThread(NULL,0,(unsigned long (__stdcall *)(void *))WorkerThreadProc,this,0,0);
You'll need to use AfxBeginThread() here.
vinaycool wrote: CStatusDlg status;
status will need to be a pointer to a CStatusDlg . You need to cast Param to this.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
hi,
Thanks for the responce ...
Can u please tell me with an example so that i can understand the things well.
|
|
|
|
|
Hi,
I got the solutiion ..Thanks a lot for all the help ....
|
|
|
|
|
Hi,
I have a customised menu class derieved from CMenu.
I have overridden the DrawItem n MeasureItem functions.
The problem is with having title for child menu.
I'm addin childmenu through
AppendMenu(MF_POPUP | MF_GRAYED | MF_OWNERDRAW , nID, (LPCTSTR)color))
now if I want to have a title for submenu eg:colors in the below case
shapes
colors->green
red
sizes
how can that be done.
Even if I use InsertMenu() then again there is a problem,we cannot have OwnerDraw n
MF_STRING together.
Is there any solution for this?
Thanks.
|
|
|
|
|
Hi All,
Can anyone tell me how to find out whether a given path belongs to a file or folder in windows??
Thanks and Regards,
Anil
|
|
|
|
|
Hi Anil
Use FindFirst and FindNext function to find out the given path is file or folder
Regards
KK
|
|
|
|
|
Hi,
You can use GetFileAttributesEx -> if dwFileAttributes from WIN32_FILE_ATTRIBUTE_DATA struct will have FILE_ATTRIBUTE_DIRECTORY - so it's directory
-----------
Mila
|
|
|
|
|
hi,
try CPath::IsDirectory(). But it is an ATL class. You have to include atlpath.h
Adios,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
<br />
WIN32_FIND_DATA m_data;<br />
HANDLE hFile;<br />
hFile=FindFirstFile(filename,&m_data)<br />
if(hFile==INVALID_HANDLE_VALUE)
else<br />
FindClose(hFile);<br />
whitesky
|
|
|
|
|
Could any one please let me know the answer for the question.
Is there any difference. May defenetly there is some difference.
Diff btwn int *p=NULL & int *p=0; ??
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
No, there is no difference, NULL is defined as 0.
It's just that using NULL for a pointer is more convenient (to make the difference with the 0 value).
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
To add to what Cedric said we use that to avoid Magic Numbers in our code.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Hi
No difference between NULL & 0
In VC header file NULL is defined as 0
KK
|
|
|
|
|
There isn't sintax difference, look at the macro:
#define NULL 0
but there is a logical difference:
pointers doesn't contains numbers but addresses, so p=0 is logically incorrect, it must be set to the default null address(NULL ). That, of course, for convention and semplicity it is set to 0.
Using NULL is only a way to write more readable code.
|
|
|
|
|
|
In C++, nothing. In C, lots. A standard C compiler won't automatically convert 0 to a pointer, so you'll have to assign (void*)0 . In C, NULL is defined as ((void*)0) to allow you to set a pointer to 0. In C++, the compiler will happily convert 0 to a pointer, so you don't need the cast, and NULL is simply defined as 0.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
Hi ,
i m trying to create an scrollbar as an activeX component which resizes itself based on image it is attached .
Please reply ASAP
suren
|
|
|
|
|
We are using a CComboBoxEx with style set to droplist to display a lsit of images.
When the drop down list appears and we click on the combobox (not on the drop down arrow),
the dropdown list closes as expected but then it immediately reopens!
How to prevent this behavior?
If instead we click on the drop down arrow when the list is open it decently closes without reopening.
|
|
|
|
|
Hi All,
I have an owner-drawn list box.
now my task is to fit a scroll bar for that.
when im trying to get the scroll position using CLisbox::GetScrollPos, it is always returning 0. how we can determine the current scroll position?
Currently im scrolling teh items by sending SendMessage(WM_VSCROLL,MAKEWPARAM(SB_LINEUP,0),0); function. will this update the current scroll position. in a normal list box im exactly getting the scroll position, but with owner-drawn one, im not getting.
anyone can suggest a solution for this problem? I need to draw the scrollbar as the part of lisbox not as a seperate control.
now tracking teh thumb is the main issue. pls help me to come out from this.
-Sarath
|
|
|
|
|
Hi,
Can I use MFC classes in Win32 Console based applicaiton.
Or
Can I use MFC classes in Windows Service application.
If answer if for one or both is YES then could you please send the link or example that how can do this?
Thanks
Regards.
|
|
|
|