|
Ok here are cutout of the codes that i have..
in LPAServerDlg.h
class CLPAServerDlg : public CDialog<br />
{<br />
public:<br />
void AddListItem(CString strbufffn, CString strbuffip,<br />
CString strbuffdate, CString strbuffstat);<br />
}
in LPAServerDlg.cpp
DWORD WINAPI ListenThread(LPVOID lParam);<br />
DWORD WINAPI ReceiveThread(LPVOID lParam);
<br />
class CAboutDlg : public CDialog<br />
{<br />
};<br />
<br />
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)<br />
{<br />
}<br />
<br />
DWORD WINAPI ReceiveThread(LPVOID lParam)<br />
{<br />
...codes<br />
AddListItem(strbufffn, strbuffipa, "Time", "Printing");<br />
...codes<br />
}<br />
<br />
DWORD WINAPI ListenThread(LPVOID lParam)<br />
{<br />
..codes<br />
hThread = CreateThread(0, 0, ReceiveThread, (LPVOID)Message, 0, NULL);<br />
..codes<br />
}<br />
<br />
void CLPAServerDlg::AddListItem(CString strbufffn, CString strbuffip,<br />
CString strbuffdate, CString strbuffstat)<br />
{<br />
int nItem;<br />
<br />
nItem = m_ListFile.InsertItem(0,strbufffn);<br />
m_ListFile.SetItemText(nItem, 1,strbuffip);<br />
m_ListFile.SetItemText(nItem, 2,strbuffdate);<br />
m_ListFile.SetItemText(nItem, 3,strbuffstat);<br />
}<br />
error C2440: '=' : from 'void (__thiscall CLPAServerDlg::*)(class CString,class CString,class CString,class CString)' to 'void (__cdecl *)(class CString,class CString
,class CString,class CString)' cannot change. (see the new of operation ; help)
sorry bout the error message.. its all in japanese and i just translated it. Thanks again for all your time and help!
|
|
|
|
|
Can you indicate on which line the error occurs?
Steve
|
|
|
|
|
oh, sorry but i pasted the wrong error message. the error line there occured on the call of the AddLIstItem() on the ReceiveThread.
|
|
|
|
|
I'm still not sure where the error occured or now if the error you gave is the correct error. If the error message is correct it means you're trying to assign a member function pointer to a pointer that expects a "free" (non member) function.
Steve
|
|
|
|
|
I made changes in my code earlier thats why i pasted the wrong error message. I attempted earlier to pass the function's address to the thread but failed. Still i cant directly call a function of the class inside a thread even though they are of the same file.
Here is the correct error message..
E:\Program Files\Microsoft Visual Studio\MyProjects\LPAServer\LPAServerDlg.cpp(355) : error C2065: 'AddListItem' : It is the discernment child who is not defined.
Again, thanks alot for the time Steve
|
|
|
|
|
I haven't got the whole file so line numbers don't tell me where the error occured. You'll have to show post some code and mark the line where the error occurs.
Steve
|
|
|
|
|
DWORD WINAPI ReceiveThread(LPVOID lParam)<br />
{<br />
...codes<br />
AddListItem(strbufffn, strbuffipa, "Time", "Printing");
...codes<br />
}
|
|
|
|
|
ReceiveThread is a global function not a class member. AddListItem is a member function. You have to call a member function either in another member function or qualify the call using a . or a -> .
Steve
|
|
|
|
|
You need an object of your class type to call a non-static member function of that type.
You could pass an object (pointer) into your thread proc via the lParam:
DWORD WINAPI ReceiveThread(LPVOID lParam)
{
MyClass *pMyClass = (MyClass *)lParam;
//some processing here
pMyClass->AddListItem(...);
}
Pass the MyClass pointer as the LPVOID lpParameter in the CreateThread() call.
|
|
|
|
|
ok ill try that in a bit. but would it also be possible of passing the pointer of the function?
|
|
|
|
|
Llasus wrote: but would it also be possible of passing the pointer of the function?
Yes, but only if it's a static method, or a regular function.
--
Featuring GRATUITOUS ALIEN NUDITY
|
|
|
|
|
i have tried doing a static method however, since inside the function i am doing access to a non-static CListCtrl in which ill need to add items to it generates the error that it cant recognize the CListCtrl of the list in the dialog box.
|
|
|
|
|
Thanks Mark, I have already solved the problem using your way by passing the pointer to the class.
|
|
|
|
|
In icon view... is there a way to set the spacing between the top border and the top items? I'm using set position, but when I scroll down and then up again, the top icons are reassigned to a distance of about 2 pixels from the border.
This is how it looks:
-----------------------
| TTTT | 1 or 2 pixels (default)
| |
| |
| |
This is what i want:
-----------------------
| | 20 pixels
| TTTT |
| |
| |
|
|
|
|
|
Have you played around with the LVS_ALIGNxxx styles?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You mean LVS_ALIGNTOP and LVS_ALIGNLEFT? There's nothing I can play with there...
|
|
|
|
|
skullfire wrote: You mean LVS_ALIGNTOP and LVS_ALIGNLEFT?
Yes, and LVS_ALIGNRIGHT and LVS_ALIGNBOTTOM .
skullfire wrote: There's nothing I can play with there...
Why not?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I wonder if unsigned 64bit integer is valid on a vc++ 6.0 compiler. In my application I have to use uint64 data type and whenever I try to use the command that is assigned to this, it fails. These are the two syntaxes that I have to use to define the buffers and the second one is for 64bit unsigned integer buffer on a system having a 64bit compiler and the first one is for systems with non-64bit compiler. If I have to use the first one, how can I define the low/high offsets and low/high transferlen.
Suppose I want to start the buffer with zero offset and buffer length of 1024x1024bytes.
//*************************************************************************
uint32 _stdcall spcm_dwDefTransfer_i64m(// Defines the transer buffer by using 2 x 32 bit unsigned integer values for each 64 bit value
drv_handle hDevice, // handle to an already opened device
uint32 dwBufType, // type of the buffer to define
uint32 dwDirection, // the transfer direction as defined above
uint32 dwNotifySize, // amount of bytes after which i want do receive
void* pvDataBuffer, // pointer to the data buffer
uint32 dwBrdOffsH, // high part of offset in board memory
uint32 dwBrdOffsL, // low part of offset in board memory
uint32 dwTransferLenH, // high part of transfer buffer length
uint32 dwTransferLenL); // low part of transfer buffer length
//*************************************************************************
uint32 _stdcall spcm_dwDefTransfer_i64 (// Defines the transer buffer by using 64 bit unsigned integer values
drv_handle hDevice, // handle to an already opened device
uint32 dwBufType, // type of the buffer to define as listed above
uint32 dwDirection, // the transfer direction as defined above
uint32 dwNotifySize, // amount of bytes after which i want do receive
void* pvDataBuffer, // pointer to the data buffer
uint64 qwBrdOffs, // offset for transfer in board memory
uint64 qwTransferLen); // buffer length
thanks,
-Pavan.
-- modified at 18:07 Wednesday 8th November, 2006
|
|
|
|
|
Did you try using the LARGE_INTEGER struct?
|
|
|
|
|
Sorry, didn't get you, I know there is LARGE_INTEGER data type, but where do you want me to use it?? This command is specific to the board driver that I am using.
thanks,
-Pavan
|
|
|
|
|
Something like this?
uint32 _stdcall spcm_dwDefTransfer_i64 (
drv_handle hDevice,
uint32 dwBufType,
uint32 dwDirection,
uint32 dwNotifySize,
void* pvDataBuffer,
union
{
uint64 qwBrdOffs;
struct
{
uint32 dwBrdOffsL;
uint32 dwBrdOffsH;
};
};
union
{
uint64 qwTransferLen;
struct
{
uint32 dwTransferLenL;
uint32 dwTransferLenH;
};
};
*EDIT* Fixed some typing :)
-- modified at 19:04 Wednesday 8th November, 2006
|
|
|
|
|
I have no idea how their developers (strategic-test) have developed these two syntaxes. Maybe same as how you defined, but I am not sure. I have asked their technical support to rephrase my i64 command into i64m command.
BTW how can we define the low and high addresses or lengths for a 64bit integer while accesses it in 32bit fashion??
-Pavan
|
|
|
|
|
pavanbabut wrote: BTW how can we define the low and high addresses or lengths for a 64bit integer while accesses it in 32bit fashion
With the structure I showed as an example you can access them either way - through the dw or the qw members.
The struct will work for both 32 and 64 bit but that doesn't mean that's what the driver vendor
does.
|
|
|
|
|
Why not use
typedef unsigned __int64 uint64;
typedef __int64 int64;
Which gives you easy to use 64 bit types just like unsigned/signed ints of other sizes, and then use unions as shown above to deal with the component parts?
Steve S
Developer for hire
|
|
|
|
|
How can I read a whole line from a text file into a string in C?
|
|
|
|