|
Did you (still) get a runtime error? Is it reproducible (at a particular statement)? Did you implement a try/catch block?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I’m trying to get a handle to an wrapped ActiveX class like this:
(The ActiveX is running inside AutoCad.)
<br />
_DDataBaseTreeView *pPE;
HRESULT res;<br />
<br />
CLSID clsid;<br />
<br />
CLSIDFromProgID(L"NetModeler.DataBaseTreeView.1", &clsid); <br />
IUnknown *pUnk = NULL;<br />
IDispatch *pDisp = NULL;<br />
<br />
HRESULT hr = GetActiveObject(clsid, NULL, (IUnknown**)&pPE);
<br />
if(SUCCEEDED(hr)) <br />
{<br />
hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDisp ); <br />
if( SUCCEEDED(hr) )<br />
{<br />
}<br />
<br />
}<br />
<br />
_variant_t var;<br />
<br />
<br />
var = pPE->Func();
What have I missed?
I want to have a handle to an already running ActiveX inside AutoCad.
_____________________________
...and justice for all
APe
|
|
|
|
|
QueryInterface must query the interface it needed:
pUnk->QueryInterface(IID_IAUTOCAD_OR_SMTH_ELSE, (void**)&pDisp);
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
where do I find that:
4apai wrote:
IID_IAUTOCAD_OR_SMTH_ELSE
_____________________________
...and justice for all
APe
|
|
|
|
|
first try to find it via typing ::(Ctrl+space) - this will list all the objects in the current namespace
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
Ok.
Now I, in some way, get it to work with IID_IDispatch...
_____________________________
...and justice for all
APe
|
|
|
|
|
Hi All,
Could anyone pleae provide me sample application for binarytree creation, search, delete and list all items.
Thanks in Advance.
Be simple and Be sample.
|
|
|
|
|
http://www.google.com.ua/search?hl=uk&ie=UTF-8&q=binary+tree+c%2B%2B+code+sample&meta=
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
Is there any way we can underline some of the items
of a listbox ??
if yes, then how ???
|
|
|
|
|
|
hi davey,
what exactly i want is that,
a listbox which have some of the url's as items
so when i double click that item data i can go
straight away to the web page.
for that i need some of my item data(not all) to be underlined so that it depicts a URL.
bye
|
|
|
|
|
hello,
try handling the NM_CUSTOMDRAW message. This is a lot easier than owner draw. also you can specify which cell to modify.
There some really great tuts around here. Please take a look in the list control topics section.
|
|
|
|
|
Hi all,
I am new to InstallShield Developer 7...I would like to know how to launch multiple .msi from a master .msi file / setup.exe....
also I need to have the progress bar UI dialog during the lauches..
one for each .msi
another for overall installation progress...
I started going thru the help, but at the meantime, if someone can give me this info, it will be very helpful for me...
Thank you,
Shiva P
|
|
|
|
|
hi,
i was creating a server from CSocket but whenever the client connects to the server, my server dialog box will automatically close itself. i wonder of there is anything wrong with my code?
i have a mysocket class, below is part of the code:
void mysocket::OnAccept(int nErrorCode)
{
if ( nErrorCode == 0 )
( ( CMultiAPIDlg* ) m_pWnd ) -> onaccept( ) ;
CSocket::OnAccept(nErrorCode);
}
in my code for the dialog box, when user press connect, the following function is evoked:
void CMultiAPIDlg::OnBConnect()
{
m_connectsocket.Create ( 0 ) ;
m_connectsocket.Connect ( m_server, m_port) ;
}
and the onaccept function is:
void CMultiAPIDlg::onaccept()
{
AfxMessageBox("Connected");
m_listensocket.Accept ( m_connectsocket ) ;
}
somehow, when the client connects to the server, the server dialog box will automatically close itself... can anyone help?
|
|
|
|
|
honestly, i didnt work with sockets via MFC, but in DOS serverside app this looks like following call-sequence:
1. bind
2. listen
3. accept
4. recv/send
i think it wouldn't differ enough with an MFC algorythm...
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
Okay I'm going to make an attempt to answer this.
Anonymous wrote:
void CMultiAPIDlg::OnBConnect()
{
m_connectsocket.Create ( 0 ) ;
m_connectsocket.Connect ( m_server, m_port) ;
}
This should be a create then a listen. Like this
void CMultiAPIDlg::OnBConnect() <br />
{<br />
m_listensocket.Create ( m_port ) ;<br />
m_listensocket.Listen ( ) ;<br />
}
The Create is where you specifiy what port you want your server listening on. Next you must listen for a connection. Also to make it easier switch your class reference around to reflect your app. For servers they listen, for clients they connect. So in the code above I switched the references around. Now just accept your connection just like you have it.
One last suggestion in your mysocket class, in the onconnect, I would do something like this:
if (nErrorCode != 0)<br />
{<br />
switch( nErrorCode )<br />
{<br />
case WSAEADDRINUSE: <br />
AfxMessageBox("The specified address is already in use.\n");<br />
break;<br />
case WSAEADDRNOTAVAIL: <br />
AfxMessageBox("The specified address is not available from the local machine.\n");<br />
break;<br />
case WSAEAFNOSUPPORT: <br />
AfxMessageBox("Addresses in the specified family cannot be used with this socket.\n");<br />
break;<br />
case WSAECONNREFUSED: <br />
AfxMessageBox("The attempt to connect was forcefully rejected.\n");<br />
break;<br />
case WSAEDESTADDRREQ: <br />
AfxMessageBox("A destination address is required.\n");<br />
break;<br />
case WSAEFAULT: <br />
AfxMessageBox("The lpSockAddrLen argument is incorrect.\n");<br />
break;<br />
case WSAEINVAL: <br />
AfxMessageBox("The socket is already bound to an address.\n");<br />
break;<br />
case WSAEISCONN: <br />
AfxMessageBox("The socket is already connected.\n");<br />
break;<br />
case WSAEMFILE: <br />
AfxMessageBox("No more file descriptors are available.\n");<br />
break;<br />
case WSAENETUNREACH: <br />
AfxMessageBox("The network cannot be reached from this host at this time.\n");<br />
break;<br />
case WSAENOBUFS: <br />
AfxMessageBox("No buffer space is available. The socket cannot be connected.\n");<br />
break;<br />
case WSAENOTCONN: <br />
AfxMessageBox("The socket is not connected.\n");<br />
break;<br />
case WSAENOTSOCK: <br />
AfxMessageBox("The descriptor is a file, not a socket.\n");<br />
break;<br />
case WSAETIMEDOUT: <br />
AfxMessageBox("The attempt to connect timed out without establishing a connection. \n");<br />
break;<br />
default:<br />
TCHAR szError[256];<br />
wsprintf(szError, "OnConnect error: %d", nErrorCode);<br />
AfxMessageBox(szError);<br />
break;<br />
}
That way you know why your not connecting.
Hope this helps
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
You get no error messages? What about in debug mode do you get an unhandled exception or assertion failure?
Anonymous wrote:
AfxMessageBox("Connected");
Does that happen before the dialog closes?
Is m_listensocket.Listen() called in a worker thread? If so then, m_pWnd may not be valid in the mysock::OnAccept() member. MFC Window objects should not be passed accross threads. You can find Knowledgebase articles on this subject on MSDN.
At runtime do you have two instances of CMultiAPIDlg, one running as server and the second as the client?
-- signature under construction -- -pete
|
|
|
|
|
hi!
i'm so sorry i've wrongly quoted the client section of my code. the actual code of my server is
void CMultiAPIDlg::OnBConnect()
{
m_listensocket.Create ( m_port );
m_listensocket.Listen( ) ;
AfxMessageBox("Listening");
}
when the server is connected, the message "Listening" appears. hence, there's no problem with this part.
but when the client trys to connect, the following code was not evoked at all since i did not get the "Connected" message. the dialog box simply closes...
void mysocket::OnAccept(int nErrorCode)
{
AfxMessageBox("Connected");
if ( nErrorCode == 0 )
( ( CMultiAPIDlg* ) m_pWnd ) -> onaccept( ) ;
CSocket::OnAccept(nErrorCode);
}
and i do not have 2 instance of CMultiAPIDlg running cos i've another program named SOCK_CIENT working as a client ...
|
|
|
|
|
hi,
i'm so sorry, i've run the program in debug mode and received the following error message,
Unhandled exception in MultiAPI.exe: 0xC0000005: Access Violation
i wonder what this means?
|
|
|
|
|
I can't find anything in what you posted to indicate a problem. Also your description of the behavior does not even indicate that the socket has anything to do with the dialog closing. I can't even think of a theory of what could cause the dialog to close without at least firing an assertion.
You might try using Spy to watch the messages arriving in the dialog that closes to get some indication of why/how it is closing. Also Debugging and Tracing techniques could prove helpful.
Have you ever done a tutorial/sample socket project? I believe MSDN has something like a chat or something that uses CAsyncSocket or CSocket.
-- signature under construction -- -pete
|
|
|
|
|
hi.
does anyone know how to get token identifier from the existing SID?
any ideas?
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
I’d like to make the following call:
_DDataBaseTreeView PE;
GetActiveObject( "NetModeler.DataBaseTreeView.1", NULL, &PE );
Howto…..?
_____________________________
...and justice for all
APe
|
|
|
|
|
try following:
"Looks up a CLSID in the registry, given a ProgID.
HRESULT CLSIDFromProgID(
LPCOLESTR lpszProgID,
LPCLSID pclsid
);"
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
Many thanks!!
_____________________________
...and justice for all
APe
|
|
|
|
|
I need to store binary files in access database.
i've tried with no success (yet) to create an interface between MS-Access table containing an "OLE Object" field type and my application. i thougt to reffer my binary files as Bitmap but still i couldn't load/save data to my DB table.
any idea?
is blob handling can help - how do i store blob?
Cheers,
Yaeli
|
|
|
|