|
First, I'm sorry for my English.
Now, I have really big problem for me!
I have two kind of source.
First one is coded with C(which one uses singlethread), and second one is coded with C++( MFC )--(which one uses Multithread).
What I did to make one application, I just open new project with Visual C++, and making a dialog box, some buttons, and just include C codes.
And, I had many Errors! So, I added some statement to use C code in MFC ( extern "C" ... )
But, and then I had real problem.
That is different kind thread can not be use for one application......
So, this is my problem.
How can I solve this problem?
Or, is there any way to make one application with two kind of codes?
please answer me..
|
|
|
|
|
Every C statement in existance is valid C++, so I'd suggest this was not the problem. You should probably put up some code or an example of the sort of errors you are having, it's impossible to give specififc advice without specific problems to solve.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Er, with the addition of stronger type checking of parameters to functions in C++. This can result in a lot of casting patches when compiling C code in C++.
|
|
|
|
|
Hello!
I'm developing a very simple application (using MFC) which all it does is show a splash screen, launch and configure the Internet Explorer UI (I'm using IWebBrowser2 to do that). Now my problem is that i need to eliminate IE's accelerator keys, so that the user can't insert a URL pressing CTRL+O. I would also like to disable IE's right-button pop-up menus. As far as I can see the IWebBrowser2 interface doesn't provide
this kind of functionality.
Can you please, give me some advise on how can this be done?
Thank you very much!
Luís Teixeira
|
|
|
|
|
Hello!
I'm developing a very simple application (using MFC) which all it does is show a splash screen, launch and configure the Internet Explorer UI (I'm using IWebBrowser2 to do that). Now my problem is that i need to eliminate IE's accelerator keys, so that the user can't insert a URL pressing CTRL+O. I would also like to disable IE's right-button pop-up menus. As far as I can see the IWebBrowser2 interface doesn't provide
this kind of functionality.
Can you please, give me some advise on how can this be done?
Thank you very much!
Luís Teixeira
|
|
|
|
|
You have to implement an object that intercept the events from IWebBrowser2. This interface is DWebBrowseEvents(2). This object - I call it sink dispatcher - must implement the interface IDocHostUIHandler. This interface has a method called TranslateAccelerator. Implement this interface leaving all other interface specific method to return E_NOTIMPL ( = "do default") and TranslateAccelerator returning S_OK ( = "let me do it, do NOT do the default"). For disabling popup menus, you have also to implement the ShowContextMenu method (of the same interface) by simply returning S_OK instead of E_NOTIMPL that will let IE to handle the context menu. But first of all you have to get the IWebBrowser2 object (this is simple, since you are telling that the project is MFC) and to call Advise to let your dispatcher object to do the job (that is, in more cases, to return E_NOTIMPL ).
So: I suppose you have a dialog where the WebBrowser control is incapsulated. I can tell you how to eliminate also the resources and to create dynamically the whole stuff.
1) Create a window. [optional, but maybe you want a toolbar, a status bar etc.]
2) Create a dialog (encapsulated in that window, if you did (1)).
3) Implement an interface derived from DWebBrowserEvents2 (let's call it ISinkDispatcher);
4) Implement an interface derived from IOleClientSite, IOleInPlaceSite (optional) and IDocHostUIHandler (for you, mandatory);
5) in OnInitDialog of your dialog, do this (the OLE API way, I don't use MFC a lot):
BOOL
WebBrowser_OnInitBrowser(HWND hWnd)
{
IStorage *pStorage = (IStorage *)NULL;
ILockBytes *pLockBytes = (ILockBytes *)NULL;
IWebOleClientSite *pWebOleClientSite = (IWebOleClientSite *)NULL;
IOleObject *pOleObject = (IOleObject *)NULL;
pWebOleClientSite = new IWebOleClientSite(hWnd);
LPWEBDIALOGDATA lpWebDlgData = (LPWEBDIALOGDATA)GetWindowLong(hWnd, DWL_USER);
lpWebDlgData->pWebOleClientSite = pWebOleClientSite;
CreateILockBytesOnHGlobal(NULL, TRUE, &pLockBytes);
StgCreateDocfileOnILockBytes(pLockBytes,
STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage);
OleCreate(CLSID_WebBrowser, IID_IOleObject, OLERENDER_DRAW, NULL,
pWebOleClientSite, pStorage, (LPVOID *)&pOleObject);
pWebOleClientSite->m_pIOleObject = pOleObject;
pWebOleClientSite->m_hWndOwner = hWnd;
pWebOleClientSite->ConnectEvents();
pWebOleClientSite->Show();
pOleObject->Release();
pStorage->Release();
pLockBytes->Release();
return TRUE;
}
(The error handling is for you).
6) ConnectEvents should get the IConnectionPointContainer interface of the IWebBrowser2 object, and to FindConnectionPoint with iid = DIID_DWebBrowserEvents2. If succeeded (= have IE installed ) you can create here your ISinkDiapatcher object and call IConnectionPoint's Advise passing your dispatcher. Something like this:
HRESULT
IWebOleClientSite::ConnectEvents()
{
HRESULT hr = E_NOINTERFACE;
IWebBrowser2 *pWebBrowser = (IWebBrowser2 *)NULL;
hr = m_pIOleObject->QueryInterface(IID_IWebBrowser2, (LPVOID *)&pWebBrowser);
if(SUCCEEDED(hr))
{
hr = pWebBrowser->put_TheaterMode((VARIANT_BOOL)1);
hr = pWebBrowser->put_RegisterAsBrowser((VARIANT_BOOL)1);
IConnectionPointContainer *pCPI = (IConnectionPointContainer *)NULL;
hr = pWebBrowser->QueryInterface(IID_IConnectionPointContainer , (LPVOID *)&pCPI);
if(SUCCEEDED(hr))
{
hr = pCPI->FindConnectionPoint(DIID_DWebBrowserEvents2, &m_pConnectionPoint);
if(SUCCEEDED(hr))
{
m_pSinkDispatcher = new ISinkDispatcher;
hr = m_pConnectionPoint->Advise(reinterpret_cast<IDispatch*>(m_pSinkDispatcher), &m_dwCookie);
if(SUCCEEDED(hr))
{
m_pSinkDispatcher->SetClientSite(this);
}
}
pCPI->Release();
}
pWebBrowser->Release();
};
return hr;
}
(Don't forget: if you have a ConnectEvents, do also a DisconnectEvents on dialog close).
In few moments I'll post a sample about this on CodeTools. If these lines above are quite complicated (and I agree), maybe reading sample, building and debugging on your own can be more helpful that these aglomerated lines...
All the best,
Sardaukar
|
|
|
|
|
How to determine the cursor shape. I am interested in a function that returns a CONSTANT of some kind. If not is there an API fuction that returns a bitmap, or a Windows image handle?
|
|
|
|
|
GetCursor.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hiya
Does anyone know anything about addins for Outlook Express? I've read about doing it using COM for Outlook 2000 but I can seem to find much about how to do it for Express. Any ideas anyone?
Noodle
|
|
|
|
|
Outlook Express has no automation model. As such, you can't create COM add-ins for it.
|
|
|
|
|
Hiya
thanks for the info
I was thinking about maybe using MAPI to get into outlook using an object and creating any toolbars and windows using standard SDK stuff (making the toolbar seperate from outlook). Would this approach be possible?
Thanks
Noodle
|
|
|
|
|
Again, Outlook Express does not expose an automation model. Outlook Express does not use MAPI.
|
|
|
|
|
Hi Erik,
This seems to be common wisdom that EO does not support COM addins/plugins or an object model.I have seen quite a few programs like PGP extend OE and have wondered how they do it? Although external programs can hack into the toolbar/menuitems creation with windows hooks etc, I do believe OE did (does?) have an extensible architecture.
Strange thing is, recently while programming evc with MS embedded tools while goinf thru the PocketPC SDK files,
I came across 2 files msoeapi.h and msoeapi.idl and it definately shows that OE had(has?) an MS Outlook like COM addin architecture.
Has anybody come across these files/undocumented OE Api?
What's going on?
'My capacity for happiness', he added, 'you could fit into a matchbox without taking out the matches first'.
- Marvin, the robot.
Amit Dey
sonork: 100:18407
msn: visualcdev
|
|
|
|
|
Hi
I want to use a timeout value but i don't know. I use only Win32 Api and Winsock 1.1.
Anyone can help me please ?
Thansk a lot
Eric
|
|
|
|
|
I used a timeout for socket connection. It works like this. But note that this is just an example. There may be typing errors and I am sure it can be wrapped to some funtions.
//1 Create a socket
m_hSocket = ::socket(PF_INET, SOCK_STREAM, 0);
//2 Set time out
struct timeval TimeVal;
TimeVal.tv_sec = iTimeOutSecond;//Pass the time out time here
TimeVal.tv_usec = iTimeOutMicroSecond;
//Try to make socket non-blocking
unsigned long ulNonBlocking = 1;
int iResult = ioctlsocket (m_hSocket,FIONBIO,&ulNonBlocking);//Try to set non-blocking
// connects to peer
int r = ::connect(m_hSocket, (SOCKADDR*)&Peer, sizeof(Peer));
fd_set ReadEvent, WriteEvents, ExceptionEvents;
FD_ZERO (&ReadEvent);
FD_SET (m_hSocket,&ReadEvent);
FD_ZERO (&WriteEvents);
FD_SET (m_hSocket,&WriteEvents);
FD_ZERO (&ExceptionEvents);
FD_SET (m_hSocket,&ExceptionEvents);
int iResult = select (NULL,&ReadEvent,&WriteEvents,&ExceptionEvents,&TimeVal);
if ((iResult == SOCKET_ERROR ) || (iResult == 0) ) //Error or time-out
{
return FALSE;
}
I hope it helps.
www.geocities.com/ton_soft
|
|
|
|
|
Watch out for the use of "select". It has been reported not to be very user-friendly, since it can be a bit tricky - things can happen such as it returning from a ReadEvent and not really being read-ready.
Take a look at http://www.cyberport.com/~tangent/programming/winsock/ (Winsock FAQ).
Cheers,
JFC
|
|
|
|
|
Timeout for what? Remember that, for example, "connect" has it's own timeout...
Can you be more specific as to the way you are using your sockets?
Cheers,
JFC
|
|
|
|
|
I don't know the value of connect timeout ? It's too Long.
Do you how to change this value?
Thanks
|
|
|
|
|
Try using setsockopt API.
|
|
|
|
|
Hi. I need your advice.
I have a large network with the unix-based server (Solaris) and I need to implement some kind of remote administration for this network.
Clients are Win9x, WinNT, Win2k etc...
So I want to use DCOM (cause it's easy to implement in under Win), but what about unix server, that will create these objects on remote machines? Is it easy to work with DCOM under unix (if it is possible) or I must use CORBA (and is it easy to work with CORBA under Win)?
What do you think?
With the best regards, Vitaly.
|
|
|
|
|
It is barely possible to use COM/DCOm on Unix machines but I've never seen it done. It will have to CORBA and God have mercy on your soul.
|
|
|
|
|
Can you try using Microsoft Interix but not sure whether it would work on a w98 m/c
http://www.microsoft.com/windows2000/interix/
I have also heard something on services for unix from Microsoft.
Cheers
Kannan
|
|
|
|
|
<<< In the name of GOD >>>
Hi all.
I want to get ID of object that we are in that(Focus).
For example if i am in Edit Box, this function should return ID of
Edit Box ...
OK ???
Hadi Rezaie
|
|
|
|
|
First you have to get a pointer to the control having input focus. I assume you need the id from the dlg control or parent of all child controls.
//Step 1
static CWnd* CWnd::GetFocus ()
//Step 2
After getting the pointer to the control having input focus call
CWnd::GetDlgCtrlID
this function will return you the window or control identifier value for any child window.
here is an example which can be used from a dlg
CWnd * pWnd = GetFocus ();
int iID = p -> GetDlgCtrlID ();
I hope this helps.
www.geocities.com/ton_soft
|
|
|
|
|
Thanks a looooooot.
Hadi Rezaie
|
|
|
|
|