|
Walk up the nodes to the root building a path object/string whatever you need.
|
|
|
|
|
how can i implinent thereads in MFC what is the header file that i can use if anyone know plz let me know at noumanzaidi@hotmail.com
nomy
|
|
|
|
|
you can start a thread using MFC by calling AfxBeginThread function.
The function (pointer) poassing this function should be static if it is part of a class.
normally we will pass the object pointer to teh function to access the data of the class.
u can also pass global function as thread routine.
the function should prototyped as follows
UINT FxnName(LPVOID pParam )
i think it is better to use CreateThread function instead of calling AfxBeginThread.
See MSDN for more info.
SaRath
|
|
|
|
|
SaRath C wrote: i think it is better to use CreateThread function instead of calling AfxBeginThread.
MFC is not properly initialized for the thread context when CreateThread() is used.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
See example below
UINT MyThreadProc( LPVOID pParam )
{
CMyObject* pObject = (CMyObject*)pParam;
if (pObject == NULL ||
!pObject->IsKindOf(RUNTIME_CLASS(CMyObject)))
return 1; // if pObject is not valid
// do something with 'pObject'
return 0; // thread completed successfully
}
// inside a different function in the program
.
.
.
pNewObject = new CMyObject;
AfxBeginThread(MyThreadProc, pNewObject);
SaRath
|
|
|
|
|
|
|
I use a table named FDetails with 4 text fields and a datetime field named date in MSaccess
when insert values into table ising ado recordset obj I receive some syntax error
recordset->Open("INSERT INTO FDetails(name,path,duration,volume,date) VALUES('hello','location','duration','vol','12/12/2000')",connection.GetInterfacePtr(), ADODB::adOpenForwardOnly,ADODB::adLockReadOnly, ADODB::adCmdText);
any one know inserting date into table
|
|
|
|
|
GANsJob wrote: when insert values into table ising ado recordset obj I receive some syntax error
And that error would be what?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
the error is
syntax error in insert into statement
|
|
|
|
|
See here.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Try change the field name 'date' to 'date1'. If I remember correctly, date is a reserved word in ms access.
cheers..milton kb.
|
|
|
|
|
Hello All,
I am using a Win32 regular Dll . I want to call a function written in VB application using function pointers.
The snippet from Win32 dll is as follows:
typedef int (*pt2Function)(char*);
pt2Function Objectpt2Function;
EXPORT int PASCAL PassPtr(int (*pt2Func)(char*))
{
pt2Func("arun");
return 1;
}
The Snippet from VB Application is as follows:
Public Sub Callbackfuntion(ByVal str1 As String)
MsgBox "Callbackfuntion"
End Sub
x = PassPtr(VarPtr(Callbackfuntion))
This all results in the application crash....
Can anyone suggest me a solution how I can call this function??
Thanks in Advance
Arun Tayal
|
|
|
|
|
You cannt call a VB function from c++ without using COM, because all vb dlls are com components. SO the typical win32 dll function call approch using typedef wont work here. You cave to use
#import yourvbcomponent.dll <br />
<br />
CoInitilaize(NULL)
yourvbcomponentLib::_vbclassPtr clsPtr(yourvbcomponentLib::vbclass)
<br />
CString msg = "tst msg";<br />
BSTR bstr = msg.AllocSysString();<br />
clsPtr->Callbackfuntion(bstr);<br />
SysFreeString(bstr);<br />
cheers....milton.
|
|
|
|
|
Im trying somewhat simplest idea of sockets app using multicast.
Following is what SockApp1 does:
1) OnButtonCreate() creates the port, default OS assigned port. Create(0, SOCK_DGRAM)
m_pUDPSocket->Create(0, SOCK_DGRAM);
2) When OnButtonInitMulti() the mutlicast group(ip/port) is initialized.
memset(&m_addrMulti,0,sizeof(m_addrMulti));<br />
m_addrMulti.sin_family =AF_INET;<br />
m_addrMulti.sin_addr.s_addr =inet_addr(MULTIADDR);<br />
m_addrMulti.sin_port =htons(MULTIPORT);
3) When OnButtonSend()it sends the data to the group.
SendTo(m_sendBuffer, m_sendBuffer.GetLength(), <br />
(const SOCKADDR* )&m_addrMulti, sizeof(m_addrMulti));
SockApp2 with following buttons clicked:
1) OnButtonCreate() creates the port, default OS assigned port. Create(0, SOCK_DGRAM)
m_pUDPSocket->Create(0, SOCK_DGRAM);
2) OnButtonJoinMulti() joins the multicast group.
ip_mreq mreq;<br />
memset(&mreq, 0, sizeof(ip_mreq));<br />
mreq.imr_multiaddr.s_addr = inet_addr(MULTIADDR);<br />
mreq.imr_interface.s_addr = htonl(MULTIPORT);<br />
<br />
if(SOCKET_ERROR == SetSockOpt(IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)))<br />
{<br />
AfxMessageBox("Error: Unable to add membership");<br />
return -1;<br />
}
here...
#define MULTIADDR "224.0.1.129"<br />
#define MULTIPORT319 5009
Now, SockApp1, when i click onto the Send button, OnButtonSend() shud get called in which im doing the SendTo() thing. Uptill here the App1/App2 both are working fine, and the data is being sent successfully, this im sure.
The problem is, that SockApp2, which joined the group, is unable to receive the data being sent from SockApp1.
Now, SockApp1 and SockApp2 are actually a single app, called SockApp. I added SockApp1/2 names just for the clarity of the question and understanding.
At this moment, im just wondering... why SockApp2 is not receiving the data from SockApp1???
Any ideas why?
Best regards,
JT!
|
|
|
|
|
any one???
Best regards,
JT!
|
|
|
|
|
I got error as follows
_CrtISValidHeapPointer(pUserData)
as assertion error what is that?any one help me
|
|
|
|
|
Can you be more specific please
whitesky
|
|
|
|
|
Just file reading i am reading,the whole coding is going process fine,but after InitInstance the control goes to disassembly and shows this error and sometimes unhandled exception error is also coming.
|
|
|
|
|
can you show your code that has error,please
whitesky
|
|
|
|
|
It means you're trying to delete (or free or some other heap allocation function) memory you shoudn't. Possible reasons;
- Freeing already freed memory;
- Freeing memory not allocated on the heap;
- Freeing an address in the middle of a heap block (e.g. delete ((new int[2])+1); ).
Steve
|
|
|
|
|
What line of what file is asserting? Without context, the error is rather meaningless.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
_CrtISValidHeapPointer(pUserData)
To find out what's wrong with this line, declare pUserData as constant pointer and see where you get compiler errors.
|
|
|
|
|
An assertion is something the System Uses,(and you should also use them) to make sure that an assumption is actually the case. If it is not, it will throw an exception. In this case, if you use free(p), it assumes that p is a valid heap pointer. That assumption is tested, or asserted deep in the bowels of the code, and in this case it failed, pUserData is NOT a valid heap pointer.
Go back on the Call Stack to find out what is being freed, and take it from there
LateNightsInNewry
|
|
|
|
|
Hi.
I'm coding a c++ dll with visual studio 2005 and in my project configuration properties, the Common Language Runtime Support is set to "no".
What I want is to get executables which may run in every windows machine without the need of the .NET framework, and I was wondering if I'd need another IDE to do that.
Also I'm having problems mixing up a VB 6 program which uses a c++ dll compiled with vs2005. When I run the vb executable, it holds in the process list once it's close. Nevertheless, if I compile the same VB code with vs2005 and use it with the same dll, it all works like a charm.
If you don't know the answer, clues and tips are also welcome.
Thanks in advance.
|
|
|
|