|
The web search assistant is a Deskband object that is registered under IE. You can create your own by implementing a COM object that supports IDeskband and a few other interfaces, or you can use the wizard I created under the ATL section of CodeProject for creating Deskbands.
Let me know if you have any development questions, I have done quite a few of these.
|
|
|
|
|
Can anyone tell me how to open a main menu programmatically?
In my main frame class of an MFC MDI app I have a function (OnMenuChar) that needs to mimic the functionality of pressing Alt-F on the keyboard to open the File menu. I don't want to do anything other than that, such as open a file, just open the menu so the user can then make their own choice.
I have tried several things to no avail. I can get the system menu to open, but not the main menu.
Thanks in advance for any assistance!
Jim
|
|
|
|
|
Did you try HiliteMenuItem() function?
|
|
|
|
|
You can try the following
/* Pass the handle to the window
SetForegroundWindow(hwnd)
// Pass alt- f
keybd_event(VK_MENU,0,0,0);
keybd_event('F',0,0,0);
// Release alt
keybd_event (VK_MENU, 0,KEYEVENTF_KEYUP ,0)
Regards,
Renga.
|
|
|
|
|
i founded out that the CListCtrl class has a big big bug.
I inserted only one item without subitems in that way:
// CListCtrl e.g. OnMouseClick.....
LV_ITEM lv;
lv.mask ...... and so on
lv.iItem = 0;
lv.iSubItem = 0;
rc = InsertItem( &lv );
SetItemData( rc, (long)bitmask );
so the items will be inserted but the item data will be not
the same i have inserted. it will be every time i debug it
for the next item....
e.g.
normal:
item itemdata
0 123
1 321
2 132
3 213
not normal:
item itemdata
0 321
1 132
2 213
3 123
that's very bad...
but i solved it in this way...
i deselect the sort entry in the resource workshop....
note: you don't have any sort ( ascend / descend )
right is: none
best regards
ingo eberhardt
NOTE: plz do not send me any spam mails or advert.
|
|
|
|
|
I wrote a program that simulate Brower upload file to Web Server.This Program run well in the local network,But it is fail When it connect to outside Web Site through Local Proxy server.Proxy server send the program a response message,The status code of response message is 407.
I found that if i use the HttpSendRequestEx Function of wininet.dll then proxy can response 407 status code ,if i use the HttpSendRequest function of wininet.dll then proxy accept this request.I don't know what happen about it!
Who can tell me how to the solution of this issue!
Let me can use the HttpSendRequestEx funtion of wininet.dll
upload file to web server,But proxy cann't send 407 status code.
or
Tell me how to use the HttpSendRequest function of wininet.dll writeing a upload file program
Thanks you!
|
|
|
|
|
I'm trying to implement a FTP client application. This FTP client will list the remote directory on its left pane in a tree view, which derived from CTreeView class and its sub directories or files will be listed on right pane in a list view, which derived from CListiew class.
In my application, i used CInternetSession class to handle the protocol and the CFTPConnection class for the connection.
However, i'm fail to connect to any FTP server!
I'm happy to receive any comments and advices from you!
|
|
|
|
|
#include <afx.h>
#include <afxwin.h>
#include <afxinet.h> //this is the good stuff
#include <stdio.h>
// compile for release with
// cl /MT /GX
// or for debug with
// cl /MTd /GX
CWinApp theApp;
void main()
{
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// catastropic error! MFC can't initialize
return;
}
// create a session object to initialize WININET library
// Default parameters mean the access method in the registry
// (that is, set by the "Internet" icon in the Control Panel
// will be used.
CInternetSession sess(_T("MyProgram/1.0"));
CFtpConnection* pConnect = NULL;
try
{
// Request a connection to ftp.microsoft.com. Default
// parameters mean that we'll try with username = ANONYMOUS
// and password set to the machine name @ domain name
pConnect = sess.GetFtpConnection(_T("ftp.microsoft.com"));
// use a file find object to enumerate files
CFtpFileFind finder(pConnect);
// start looping
BOOL bWorking = finder.FindFile(_T("*"));
while (bWorking)
{
bWorking = finder.FindNextFile();
printf("%s\n", (LPCTSTR) finder.GetFileURL());
}
}
catch (CInternetException* pEx)
{
TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);
printf("ERROR! %s\n", sz);
pEx->Delete();
}
// if the connection is open, close it
if (pConnect != NULL)
pConnect->Close();
delete pConnect;
return;
}
|
|
|
|
|
hi, below was my sample coding for my application
//this is my InetSession
m_pInetSession = new CInternetSession(
NULL, 1,
PRE_CONFIG_INTERNET_ACCESS );
// If the CInternetSession object didn't
// allocate, bail out.
if(m_pInetSession == NULL ){
return( 0 );
}
//ftp connection
m_pFtpConnection = m_pInetSession->GetFtpConnection(
"127.0.0.1", "", "");
what i did here is i m running an ftp server on my local host. The ftp server is a shareware program that will enable any ftp client connect to u local host without networking environment. i did try to connect to my local host by using FTP explorer shareware. its works fine. i just want to prove that my ftp server shareware is working fine. Next, i try to compile n run my application, the results were, the first was ok, but when i try to run on the second time its failed. i also try to run my application on a network environment, it was failed too !
I did refer to the MSDN FTPTREE sample program, its works fine. i try to copy out some part of the code to my application, but it was fail!
I totally have no idea what to do next, please HELP !!!
Thanks !
|
|
|
|
|
Hi
Just a guess as to why your copied and pasted code
doesn't work !
Have you made sure you statically linked your code correctly, eg included uuid.lib in
Project->Settings->Link->Object/Library modules "uuid.lib "
Its a common problem
Regardz
Colin Davies
|
|
|
|
|
if (!AfxParseURL(strFtpSite, dwServiceType, strServerName, strObject, nPort))
{
// try adding the "ftp://" protocol
CString strFtpURL = _T("ftp://");
strFtpURL += strFtpSite;
if (!AfxParseURL(strFtpURL, dwServiceType, strServerName, strObject, nPort))
{
AfxMessageBox("IDS_INVALID_URL", MB_OK);
return;
}
}
hi,
i managed to solve this problem. Just add the above code right after the InteenetSession, then it will work fine.
I ve tried it out!
|
|
|
|
|
if (!AfxParseURL(strFtpSite, dwServiceType, strServerName, strObject, nPort))
{
// try adding the "ftp://" protocol
CString strFtpURL = _T("ftp://");
strFtpURL += strFtpSite;
if (!AfxParseURL(strFtpURL, dwServiceType, strServerName, strObject, nPort))
{
AfxMessageBox("IDS_INVALID_URL", MB_OK);
return;
}
}
hi,
i managed to solve this problem. Just add the above code right after the InteenetSession, then it will work fine.
I ve tried it out!
|
|
|
|
|
if (!AfxParseURL(strFtpSite, dwServiceType, strServerName, strObject, nPort))
{
// try adding the "ftp://" protocol
CString strFtpURL = _T("ftp://");
strFtpURL += strFtpSite;
if (!AfxParseURL(strFtpURL, dwServiceType, strServerName, strObject, nPort))
{
AfxMessageBox("IDS_INVALID_URL", MB_OK);
return;
}
}
hi,
i managed to solve this problem. Just add the above code right after the InteenetSession, then it will work fine.
I ve tried it out!
|
|
|
|
|
Hi,
I'm trying to put a number of CRichEditCtrls into a CView. The control displays ok and I found some code in the MSDN about how to print the control. However in Print Preview the text always appears as it's final size, ie not the same size as other text (in the same font and size) on the CView.
Any ideas on what I've forgotten to do?
Thanks Tim Brown
|
|
|
|
|
Where I can get source code ?
|
|
|
|
|
Hello, Codegurus.
We can find the source codes from a couple of places.
1)www.codejock.com
Try to find SDIExplorer example in CJLibrary.
2)Mfcie example of MSDN library of Microsoft.
If you don't have MDSN Library CD, try to find
Mfcie of search of Microsoft web site.
HTH.
-Masaaki Onishi-
|
|
|
|
|
I developed several class using unix g++ compiler. I developed
one class in particular, called CEditString, that edits string
pointers. Every other class that I created uses this CEditString
class. At the top of all these other classes, I type
#include "EditString.H"
and within that class I type
public:
CEditString EditString;
The problem is, when I compile, I get the following error:
/code/EditString.H: In method `CEditString::CEditString()':
In file included from /code/AtomLocation.H:11,
from /code/ProteinStructure.H:13,
from topView.C:7:
/code/EditString.H:56: redefinition of `CEditString::CEditString()'
/code/EditString.H:56: `CEditString::CEditString()' previously
defined here.
I know that I am redefining the class, but if I don't redefine,
then I get that error that 'CEditString' undeclared. This is
really frustrating. Is there any way of destroying the class
so that when I do call it, I am not redefining it?
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Erich J. Ruth (an overworked graduate student)
|
|
|
|
|
Hello, Codeguru.
We can use predefine class name in this case.
/*#include "EditString.H"*/
class CEditString;
and within that class I type
public:
CEditString EditString;
HTH.
-Masaaki Onishi-
|
|
|
|
|
That won't work. If you "forward declare" a class (eg, "class CEditString;") you may only use it for pointers and references until the full declaration is given.
|
|
|
|
|
Hello, James.
I already noticed this with Mr. Hamishi post.
But, simply just change CEditString string -> CEditString* string ,and '.' -> '->'.
I think that this is more normal in C++ coding.
Regards.
-Masaaki Onishi-
|
|
|
|
|
Is it possible that within one compile unit, you have #included the EditString.h file twice? Just hazarding a guess here? If that's the case, you should add the following two lines at the start of the EditString.h file;
#ifndef EDITSTRING_H
#define EDITSTRING_H
...
...
...
rest of file and then at the very end of the file add this line
#endif // for the EDITSTRING_H
HTH.
|
|
|
|
|
Hi,
If all the other classes use the one class, just #include that file in stdafx.h. That way it will be available to
all the other classes. What you have here is called 'circular reference', where one header file gets
included more than once. As the replies suggests, you can prevent this multiple inclusion by using
#ifndef .... #define.....or use a 'forward declaration' in the header file by writing 'class CEditString'. Forward
declarations, however, are only allowed for pointer members. That is, you can say CEditString* stPtr
and not CEditString obj. What I usually do when I have a problem like this is draw a diagram showing
what files have included what, and then I can figure out a way not to include a file more than once. If
this doesn't help you then send me your whole project (syh@ufl.edu) and I'll be glad to look at it for
you. I know how frustrating this can be. Good luck.
sayed hashimi (another overworked graduate student).
|
|
|
|
|
hi,
I have a MDI app with a CRichEditView and Doc. I would like to know how I can everytime i create a new document open a Text File that i created.
This text file is a kinda report where i fill later on.
I use this text as a Template for my file.
Here is my code
void CMainFrame::OnFileNewProject()
{
// TODO: Add your command handler code here
CNewProjectDlg dlg;
if (dlg.DoModal() == IDOK)
{
if(!dlg.m_strProjectName.IsEmpty())
{
PrepareEnvironment(dlg.m_strProject, dlg.m_strProjectName );
//Update Project View
m_pDocProject->AddItem2View(dlg.m_strProjectName);
//Create a new document
CCosmoSQAApp* pApp = (CCosmoSQAApp*)AfxGetApp();
pApp->m_pDocTemplate->OpenDocumentFileNULL, TRUE);
}
}
}
Thanks
olivier
|
|
|
|
|
Hello,
I want to create a new browser as a child window of existing one? Can i do that? Any ideas??
I am using IWebBrowser2 interface. But it opens my page into default browser.
regards,
Mahesh
|
|
|
|
|
Since you are using the Internet Explorer browser control, you can insert an IFRAME HTML tag set into your existing web browser control and have the iframe navigate to the page you want.
use innerHTML method and then call execScript with code to have the IFRAME navigate elsewhere.
It's one way.
-Erik Thompson
|
|
|
|
|