|
What actually happens is I am putting the information about the file in my implementation of IDataObject and in the GetData function of IDataObject, I am using that information to communicate with Applet which in turn will download that File from the Database to the client machine.
Hope I am clear now.
Thanks and Regards,
Anil
|
|
|
|
|
There are several things to be considered while performing this operation. Its not easy as it seems. When a Drop event occurs in the Windows folder, It will immediately start querying for the type and the IDataObject.
You can implement this functionality by implementing the file->copy process in IDataObject::GetData(...)
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
XMinds
|
|
|
|
|
Jagadeesh, thats exactly what I am doing here, I am dowloading the file in the Getdata method and am putting it in the STGMEDIUM structure there...but still something seems to be missing....
|
|
|
|
|
In my MDI project. MainFrame has a m_CoolBarCtrl, m_TabCtrl and m_DirTreeCtrl. they are all dynamically created. in the Create funcation specify parent CWnd.
m_CoolBarCtrl parent is MainFrame
m_TabCtrl parent is m_CoolBarCtrl
m_DirTreeCtrl parent is m_TabCtrl
When user click on a abc.cpp file in the DirTree, I want to notify the main frame to open this file.
How can I implement this? Please give me a direction.
|
|
|
|
|
Use AfxGetMainWnd() and dynamic_cast to obtain a valid pointer to CMainFrame. Then Call the method to open the file. Thats it!!!
Alternatively you can send a message to the Mainframe HWND and handle it accrodingly in your CMainFrame class. But I suggest using the first approach.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
XMinds
|
|
|
|
|
hi,
How to Resize Dialog and Controls when Desktop resolution is changed, in VC++ Dialog based application?.
Thax,
Om
|
|
|
|
|
You need to handle WM_DISPLAYCHANGE message and then resize your dialog accordingly.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
XMinds
|
|
|
|
|
in addition to above post you can check WM_SETTINGCHANGE [Windows] tooo
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow cheers, Alok Gupta VC Forum Q&A :- I/ IV
|
|
|
|
|
Please can any one help me by providing any VC++ project wid source code. It can be as simple as possible.If the person can also provide wid the documentation of the same project that will be great.In case if no documentation is avail no rpblem,main is teh project.Please....
COOKIE
|
|
|
|
|
This site is full of projects with source code!!!
Checkout C++/MFC section.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Sure! Lets see, select file->new->projects->Win32 Console Application and follow the prompts. You now have VC++ source code that is as simple as possible.
Sorry, but you need to be more specific as to your requirements. There are hundreds of articles at CP and a great many of them cover what you are looking for. Even if you went to the CP home page and clicked a link at random along the left edge of the screen, the odds are good that you will hit a link that meets your requirments.
INTP
Every thing is relative...
|
|
|
|
|
First of all, sorry so long. I'm pulling my hair out on this problem! Check out the short description below and skip if not interested or beyond your level of expertise.
The short: I have intermittent problems communicating using TCP/IP on Windows XP Service Pack 2 with a pKernel (Posix compliant) embedded device. The embedded device is external to the PC and communicates with a PC via ethernet and/or serial port. Ethereal (sniffer) run on my XP SP2 laptop shows connection requests (SYN) are seen by Ethereal, after the embedded device is reset, but not seen by Windows XP. I am strongly leaning towards this being exclusively an XP SP2 problem but have some doubts that it may be my embedded device.
Details:
1. Problem only occurs on Windows XP SP2. I have tested with Win98 and Win2K and everything is fine. Also this problem did not occur with XP Service Pack 1. Win XP service pack 2 includes several network security things (no details) including a time client. My time server is RFC-868 compliant, referred as Time Protocol, server, and uses TCP/IP or UDP port 37. The SP2 time client is not enabled by default and uses a different port so it is not causing the problem. Some of the SP2 changes were available as add-ons to SP1 but I did not try them.
2. If time server app or service is restarted, the embedded device connects to my XP SP2 machine, every time. It is only when the embedded device is reset or powered off/on, that the embedded device cannot connect to the XP SP2 machine. Eventually after multiple resets, a connection occurs. Once a connection is made, I can re-connect endlessly as many times as desired until I reset the embedded device.
3. Problem initially was discovered with a time server module I embedded into my application. It was later discovered the problem also happens with a TFTP server module, I embedded into my application.
4. Problem was confirmed using third party time server application and third party TFTP server application.
5. Saw some Microsoft documentation that said servers should be installed and run as a service on Windows XP so I made a standalone service for the time server, and it works in Win2K flawlessly, but still fails the same way on XP SP2.
6. The embedded device tries to get time from a time server on booting up or reset, then it sets its time, and runs any onboard (flashed) application. The kernel calls a kernel library (inetlib) function, I think called cmd_ntime() to retrieve the time. As a test, I wrote a test application for the embedded device, that called the same function. FAILED. Later, I rewrote another application for the embedded device. This application was a time client (instead of calling the kernel function) that requested time from the XP SP2 machine. FAILED. Both of these test apps looped and requested time every 4 seconds. IMPORTANT: I should say that since it ran every 4 seconds, I was able to verify through debug msgs on the serial port and via Ethereal, that the application program was waiting for the connection to complete. After about a minute and a half, it inevitably connects successfully and from that point on, I can get time every 4 seconds.
7. There are no firewalls running. The problem is repeatable on numerous PCs running XP SP2.
8. ARP and MAC addresses for both the embedded device and the XP SP2 machine seem OK. I verified on the XP SP2 machine that a dynamic table was built that held/had the embedded devices MAC/IP.
When running Ethereal and seeing that a TCP/IP connection is initiated from the embedded device by send a SYN packet, it appears that XP SP2 is not seeing it but the sniffer is. Not knowing networking and driver layers that well, we strongly suspect that one possiblity may be that the SYN connection request is not being passed up the layers correctly.
Freaky Things:
I can actually get it to work, if I don't clean up my sockets i.e. don't do a shutdown() and close() socket. I have tried blocking and non-blocking (currently non-blocking using FD_SET). Documentation says that FD_SET and macros support 64 sockets and can be made to handle more sockets by resizing the structure. HOWEVER, when it does work, there are still problems. Ethereal reports a DUPlicate ACK to the initial SYN e.g. embed dev [SYN], XP SP2 [SYN,ACK].
I actually had a third party time client application which I tested on all operating systems. It also failed with XP SP2. But when I recoded my time server into a service, it now works every single time from the XP SP2 laptop or from another machine.
We have verified the cables, hubs, network adapters, (all networking hardware) are all working fine. The embedded device transmits plenty of UDP data just fine.
HERE'S WHERE I NEED HELP. Is there a sniffer (or does my current one) sniff all OSI layers? If not, does Microsoft have some sort of sniffer or debugger that would perhaps show me the data or TCP/IP connection request being passed up the layers?
Any other suggestions would be greatly appreciated. I have been working on this for over 3 weeks starting multi-threaded spawning threads for each connection request to eventually a test configuration of non-blocking service without threading. I've pulled any code that might hinder isolating this problem. THANK YOU.
-- modified at 22:47 Thursday 2nd February, 2006
|
|
|
|
|
I have a MFC application that has a lot of list view in report mode. I have implemented a CGenericListCtrl (derived from CListCtrl) that contains common functionality used in all those list views. All the list views used in my applicatons are derived from CGenericListCtrl. What I am trying to do is basically impement the sorting functionality based upon the type of the columns. For example some columns could be numeric whereas other could be string or date type. In the CGenericListCtrl I have implemnted a Compare function that apply the sorting algorithm depending upon type of the column. So Let's say I have a class CMYFirstListCtrl that is derived from CGenericListCtrl. In CMYFirstListCtrl at the time of creation of columns I also have an array that contains the type of data stored in each column ( via some enumns). What I am trying to do is that when user click on CMYFirstListCtrl header for sorting, I need to pass the column type enum to Compare method of CGenericListCtrl. Can anyone please help me how can I pass this info from a derived class to its parent though some sort of notification?
|
|
|
|
|
Hi
I am not sure if I have understood your problem!!!
What I think is that you can implement the funtionality for parent class instead of derive class, so that the parent class funtion can directly be called. this may not help you lot...
other method you may use "super" to get parent class methods and variable.
|
|
|
|
|
There is no keyword super in C++. It's available only in Java.
I am not seeing any problem whatsoever using the Sort function of the Base class. Just call the method Sort(...) and pass the parameters. As long as the Sort method is not virtual, you will always end-up in the Base class method.
Alternatively you can think of making Sort(...) method static as long as it is not refering any class memebers and you are passing all the values in the parameter list. You can invoke the method using CGenericListCtrl::Sort(...)
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Thanks for the response guys. Problem is that OnColumnClick is invoked from the dervied class and during that event I am not sure how can I pass this additional variable containing type of the header. Is there any lParam type of thing that I use to fill in this info? Thanks
|
|
|
|
|
I was browsing through the site a few weeks ago, and came a cross a simple http client that would run from a command line in the command prompt. I have tried searching again for it to no avail.. do projects sometimes get taken off of this site? If not, does anyone know which one I am talking about, and maybe provide a link?
|
|
|
|
|
conrad10781 wrote: do projects sometimes get taken off of this site?
Occasionally, authors request that their articles are removed, so yes. Also, sometimes articles are moved between categories.
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"
|
|
|
|
|
I'm clueless about using the IHTMLDocument2 interface. How do I use it to load a url or a html document? What about IDispatch Interface, do I need to use it?
|
|
|
|
|
|
Hmm what about the IHTMLDocument2 interface? how do I link the url to this interface?
|
|
|
|
|
|
Hmm what if I want to load the html document saved to disk?
|
|
|
|
|
Try this. It uses ATL. It extracts the text from google and prints it in a message box. I wipped it up pretty quickly so it's not perfect, but it works.
---
// Only needed if you're using an old SDK that hasn't got this. Remove
// if it clashes with your SDK.
MIDL_INTERFACE("3050f613-98b5-11cf-bb82-00aa00bdce0b")
HTMLDocumentEvents2 : public IDispatch
{
};
// Class to wait for the ready state to change to "complete"
// while running a message loop.
class ATL_NO_VTABLE CReadyStateComplete :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatch
{
public:
CReadyStateComplete() : m_spDoc2(NULL)
{
m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
}
~CReadyStateComplete()
{
CloseHandle(m_hEvent);
}
void SetDocument(IHTMLDocument2* pDoc2)
{
m_spDoc2 = pDoc2;
}
DECLARE_NO_REGISTRY()
BEGIN_COM_MAP(CReadyStateComplete)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
void Wait()
{
AtlWaitWithMessageLoop(m_hEvent);
}
public:
STDMETHOD(GetTypeInfoCount)(UINT* pctinfo)
{
return E_NOTIMPL;
}
STDMETHOD(GetTypeInfo)(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
{
return E_NOTIMPL;
}
STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgdispid)
{
return E_NOTIMPL;
}
STDMETHOD(Invoke)(
/*[in]*/ DISPID dispIdMember,
/*[in]*/ REFIID riid,
/*[in]*/ LCID lcid,
/*[in]*/ WORD wFlags,
/*[in, out]*/ DISPPARAMS * pDispParams,
/*[out]*/ VARIANT * pVarResult,
/*[out]*/ EXCEPINFO * pExcepInfo,
/*[out]*/ UINT * puArgErr)
{
if ( dispIdMember == DISPID_READYSTATECHANGE )
{
CComBSTR State;
if ( SUCCEEDED(m_spDoc2->get_readyState(&State)) )
{
if ( wcscmp(State, L"complete")==0 )
{
SetEvent(m_hEvent);
}
}
return S_OK;
}
return DISP_E_MEMBERNOTFOUND;
}
private:
CComPtr<IHTMLDocument2> m_spDoc2;
HANDLE m_hEvent;
};
void ExtractText()
{
HRESULT hr;
// Get a stream on the URL.
CComPtr<IMoniker> spMk;
hr = CreateURLMoniker(NULL, OLESTR("http://www.google.com/"), &spMk);
if ( FAILED(hr) )
{
return;
}
CComPtr<IBindCtx> spCtx;
hr = CreateBindCtx(0, &spCtx);
if ( FAILED(hr) )
{
return;
}
CComPtr<IStream> spStream;
hr = spMk->BindToStorage(spCtx, 0, IID_IStream, (void**)&spStream);
if ( FAILED(hr) )
{
return;
}
// Create the HTMLDocument object.
CComPtr<IUnknown> spUnk;
hr = spUnk.CoCreateInstance(CLSID_HTMLDocument);
if ( FAILED(hr) )
{
return;
}
CComQIPtr<IPersistStreamInit> spPSI(spUnk);
if ( !spPSI )
{
return;
}
CComQIPtr<IHTMLDocument2> spDoc2(spUnk);
if ( !spDoc2 )
{
return;
}
// Set up our object which watches the ready state of the document.
CComObjectGlobal<CReadyStateComplete> RS;
RS.SetDocument(spDoc2);
DWORD Cookie;
hr = AtlAdvise(spUnk, &RS, __uuidof(HTMLDocumentEvents2), &Cookie);
if ( FAILED(hr) )
{
return;
}
// Load the data from the URL into the object.
hr = spPSI->Load(spStream);
if ( FAILED(hr) )
{
AtlUnadvise(spUnk, __uuidof(HTMLDocumentEvents2), Cookie);
return;
}
// Wait (while running a message pump so MSHTML can work) till ready.
RS.Wait();
AtlUnadvise(spUnk, __uuidof(HTMLDocumentEvents2), Cookie);
// Print out the text in a message box.
CComPtr<IHTMLElement> spBodyElement;
hr = spDoc2->get_body(&spBodyElement);
if ( FAILED(hr) )
{
return;
}
CComBSTR Text;
hr = spBodyElement->get_outerText(&Text);
if ( FAILED(hr) )
{
return;
}
MessageBoxW(NULL, Text, L"Text", MB_OK);
}
Steve
-- modified at 7:41 Friday 3rd February, 2006
Added AtlUnadvise calls without testing......
|
|
|
|
|
Hi,
I am using Visual Studio .Net 2003. I compiled my MFC application in release mode. I then clicked on the executable, and my MFC GUI started. However, when I transfer the executable to other companies, the GUI doesn't start (actually, no response at all) when I click on the executable file. So does anyone why is this?
Thank you very much!!!!!!
|
|
|
|
|