|
look
Yahoo is a mail provider
the web address is: www.yahoo.com but the smpt server is mta327.mail.scd.yahoo.com that I've just found out
hotmail the same
the smpt is
mx1.hotmail.com
Speaking about confusing;
I want a funtiopn that get the smpt server for each mail provider that I send the mesage to;
for example if I write in the edit box that will take the receiver's mail
you@lalala.com
I get the lalala.com part and with a funtion get it's smpt server if it has one. Hope you can understand me.
Thank you.
gabby
|
|
|
|
|
|
Hi All,
OK I have seen numerous articles on using Multiple Views with a Single Document, but can't find anything about Multiple Documents Using a Single View. If I am wrong please provide me with the links.
What I have is an MDI with a splitter. When the user selects a Document from the New Dialog Box a Form is provided on the left (split) with a single ComboBox. The user clicks the ComboBox and makes single/multiple selections depending on the document requirements. When the ComboBox closes the Document is updated and the View is Shown on the Right. This is working great if the user always selects the first document in the New Dialog Box. However, if the next document down on the New Dialog Box is selected then I get errors.
So what I need is to find out how I tell the view which of the Documents is going to be displayed? I have tried playing with the Base DocManager Class but have been unsuccessful to this point. Can anyone enlighten me on the proper way of implementing this?
Many Thanks!
Charlie
I know this should be easy, but for some reason I just can't get it straight in my head...
Platform is Windows 2000 Professional, Visual C++ 6.0
|
|
|
|
|
Hi Charlie,
Are you sure you absolutely need multiple documents? Could you not achieve want your looking for by creating a class for each "type" of document, e.g.
public CBaseDocContents : CObject
{
// ...
}
public CDocType1Contents : CBaseDocContents
{
// ...
}
public CDocType2Contents : CBaseDocContents
{
// ...
}
etc
Then in your CDocument object, hold a CMapStringToOb collection creating an instance for each "doc object" you need, add to collection. Then hold a reference in the CDocument to the currently active "doc object".
If this is not helpful, what functionality is it of CDocument that you require? e.g. Serialize etc. ?
Hope this helps,
Andy
|
|
|
|
|
i want a flag window equivalent to visual foxpro for one of my SDI apps. that must popup on the top right corner of my framewindow, that must grow/shrink according to the content, and that must be vanish when one of the keystrokes occures.any code for that???
i wanto to invoke that like
object.FlagMessage("Hello Chris");
help me.!!!
i've no time to write one from scratch . so pls help me...
[to all lnstant article GURUS..!!.this is your turn to help me out of this..]
mind is everything.
|
|
|
|
|
You will get more help, much faster, if your subject line is more useful than this. Something like "popup tied to corner of framewindow". I rarely look at "Need Help" or "Please Help" or the like. If you cannot be bothered to give a subject, who will be interested in looking at your question?
Also, we are all busy and writing code on demand for you is unlikely to happen.
Good luck!
|
|
|
|
|
Thankyou Harold Bamford,
i posted this same with a specific subject one day earlier, but no response at all..!!!!!!
but i need this very urgently, i hope i can find a temperory solution for the time being...but will be very thankfull to you guys if you can help me ...
mind is everything.
|
|
|
|
|
I am developing a program much like FlashGet or GetRight...
It successfully downloads files but when I got to the part making it
download the files into segments, I got myself in trouble...I use
synchronous downloading, but after I start the 5 segments, just 2 of them
pass the part "HttpSendRequest" and starts downloading their parts but the
other 3 just stay there and waits for something even after the other 2
threads finish their work....after a while they either start downloading,
either fail - as they got no response(it timed out)...
After walking over the net I found that there is asynchronous downloading
too, and I'm forced to try it since the way I do it(HttpSendRequest and
InternetOpenUrl fails too) doesn't work...
I open a internet session with the async flag, then I set a status
callback function for the session. Then I call InternetOpenUrl, and I got
a NULL handle. Then I check weather the last error is ERROR_IO_PENDING and
if so I make the thread to wait for a event. That event is being signalled
by the Status Callback when it got a STATUS_RESPONSE_COMPLETE status, and
in the struct passed in the dwContext value of InternetOpenUrl(its a
struct) I set up the handle to the file.
But here's the problem...
After the thread waits for the event to get signalled, the status callback
receives just 1 status - STATUS_HANDLE_CREATED and then just crashes...
the code where it crashes is indicated in wininet.dll with a Access
Violation!
Here's source code:
PSTATUSCALLBACK hStatusCallback;<br />
hStatusCallback.nSegment = pSegment->m_nSegment;<br />
hStatusCallback.strFileName = pSegment->szFileName;<br />
hStatusCallback.strFilePath = pSegment->szFileName;<br />
hStatusCallback.strUrl = pSegment->szURL;<br />
<br />
HINTERNET hSession = InternetOpen("Agent",<br />
INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);<br />
InternetSetStatusCallback( hSession,<br />
(INTERNET_STATUS_CALLBACK)InternetCallbackFunc );<br />
HINTERNET hInetFile = InternetOpenUrl( hSession, CString(szURL,<br />
strlen(szURL)), NULL, 0, <br />
INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE | <br />
INTERNET_FLAG_NO_CACHE_WRITE, (LPARAM)&hStatusCallback );<br />
if(hInetFile == NULL && GetLastError() == ERROR_IO_PENDING) {<br />
if(WaitForSingleObject(hErrorEvent, INFINITE) == WAIT_OBJECT_0) {<br />
ResetEvent(hErrorEvent);<br />
hInetFile = hStatusCallback.hInetFile;<br />
MessageBox(NULL, "Got handle", "info", MB_OK);<br />
}else<br />
MessageBox(NULL, "Error during waiting for the Error event!", "ERROR",<br />
MB_OK | MB_ICONERROR);<br />
}
|
|
|
|
|
Ok, first post here.
I have been looking over the articles, which are great. Some seem to go into so much depth I become overwhelmed.
Right now, I am working for a company who has purchased a very poor piece of software to automate things. The program was created in visual basic, and is just about worthless.
One thing that we need is to be able to format the output from its report program, for printing our invoices etc. Since the company who made the program that we are using refuses to add in the hookings for plugin support, I am writing an external program do do what we need.
What I need to do is, monitor the program to see when it opens an instance of the reporter program, because the text that is displayed in the reporter is saved onto the hard disk in the form of a text file on our main server. I need to then open the text file, format it and print it. The latter parts are no issue for me, I am just kinda overwhelmed right now thinking of the proper way to watch the program and watch for the creation of that window. I do not want to tax the system at all, and I would think that I could do it without having any visible impact on performance.
HELP!
Thanks
Tim Reynolds
razialx
|
|
|
|
|
|
I tried that, but it doesn't work it seems because i am monitoring the file on an different computer, so when the file is changed, windows does not generate the event. I may be wrong.
Thanks anyway.
|
|
|
|
|
The answer is actually very simple you could make a thread tha will enable
HHOOK CBT = SetWindowsHookEx(WH_CBT, (HOOKPROC)CBTProc, hInst, (DWORD)NULL);
and the callback function for this is:
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam);
and in this function you have to
char path[1024],path1[1024];
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
{
if(code==HCBT_CREATEWND)
{
//you can get the module filname of the win created
GetModuleFileName(NULL, path, sizeof(path));
if(strcmp(path,path1)!=0))
{/*
here you could end the process that has just opened if don't want it opened
notice that in the path you can write a certain path that you don't want to be opened
*/
HANDLE hProc=NULL;
DWORD dwProcessId=NULL ;
HWND hnd=NULL;
LPDWORD lpExitCode=0;
GetWindowThreadProcessId(hnd, &dwProcessId);
hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)dwProcessId);
GetWindowThreadProcessId((HWND)wParam, &dwProcessId);
GetExitCodeProcess(hProc,lpExitCode);
TerminateProcess(hProc, (UINT)lpExitCode);
}
strcpy(calea1,calea);
}
return CallNextHookEx(CBT, code, wParam, lParam);
}
I have made this in a DLL but I thing is going to work with a thread.
Hope I helped although I am in highschool
gabby
|
|
|
|
|
I will give it a shot, i hope it works.
Ah.. high school. few years ago for me, hehe. I never learned much system specific coding in high school. Perhaps I should have. *shrug*
Thanks.
|
|
|
|
|
For the hInstance part of your code, what should I pass? I know I can load a specific dll and put that there, but I am not sure that is the right way for this. I do not know what DLL it is I want. The last variable, the ID, do you think I should use that instead?
Thanks.
|
|
|
|
|
Hi guys
I'd like to manage the message generated when I change from one non modal dialog to another. What message I have to control in the first dialog to know that I'm leaving this dialog (not closing, accepting or cancel,just leaving or changing to another dialog)?
Best Regards
Doc
|
|
|
|
|
Look for WM_ACTIVATE and/or WM_ACTIVATEAPP .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The message you're looking for is WM_ACTIVATE
Here's a little something about it by MSDN:
CWnd::OnActivate
The framework calls this member function when a CWnd object is being activated or deactivated.
afx_msg void OnActivate(<br />
UINT nState,<br />
CWnd* pWndOther,<br />
BOOL bMinimized <br />
);
Parameters
nState
Specifies whether the CWnd is being activated or deactivated. It can be one of the following values:
WA_INACTIVE The window is being deactivated.
WA_ACTIVE The window is being activated through some method other than a mouse click (for example, by use of the keyboard interface to select the window).
WA_CLICKACTIVE The window is being activated by a mouse click.
pWndOther
Pointer to the CWnd being activated or deactivated. The pointer can be NULL, and it may be temporary.
bMinimized
Specifies the minimized state of the CWnd being activated or deactivated. A value of TRUE indicates the window is minimized.
If TRUE, the CWnd is being activated; otherwise deactivated.
Remarks
If the CWnd object is activated with a mouse click, it will also receive an OnMouseActivate member function call.
Note This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.
|
|
|
|
|
Greetings All,
I'm trying to process the arrow keys in a modeless dialog implemented as a DLL (MFC.) I've tried various methods based on what I've found on CodeProject, but none have worked. OnKeyDown() and PreTranslateMessage() are never called in my dlg. Instead, PreTranslateMessage() in the client application that uses the DLL is called whenever I press the keys. I also tried overriding OnGetDlgCode() in my DLL dlg class and returning DLGC_WANTMESSAGE and DLGC_WANTALLKEYS, but that also had no effect.
I can't change anything in the client app to handle this because I'm not normally in control of that.
Any suggestions would be greatly appreciated.
Thanks,
Justin
|
|
|
|
|
If you haven't already tried it, consider overridding the modeless Dialog's DefWindowProc and handling the WM_KEYDOWN there. If you have already tried it and it didn't work, sorry for wasting your time.
|
|
|
|
|
I hadn't tried it yet, but I did today and I still had the same problem. Thanks for the advice, though. Not a waste of time at all I had forgotten about that particular override.
By the way, I found a description on MS' website about how to call a "FilterDllMsg()" func from the main app's PreTranslateMessage() and that, at least, allowed me to recieve the key messages in the dialog. (I'd rather be able to do this without modifying the main app code, but it's a start.)
However, I have a wierd crash bug now that goes away if I change the "m_pMainWnd = &dlg;" line in my main app's InitInstance() func to "m_pMainWnd = NULL;" If I press a key in the dialog, the DLL/app freeze. I'm probably going to post another question about this problem.
Thanks Again,
Justin
Here's the link to the MS sample: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/vcsamDllScreenCapSample.asp
|
|
|
|
|
i've got this code from MSDN
<url>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_clistbox.3a3a.deleteitem.asp
for (int i=0;i < pmyListBox->GetCount();i++)
{
pmyListBox->DeleteString( i );
}
but it doesn't work, it deletes almost every item, but not all of them. It doesn't delete all items on the list. Any ideas how to do that?
|
|
|
|
|
pmyListBox->ResetContent();
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
|
Sometimes, you need to see each item before deleting it (like to delete data associated with the item data pointer). The reason the original code didn't work was that deleting item 0 then moves all the other items up one. Then you delete item 1 and the same thing happens to items 2-n. You probably ended up with opnly about half the items deleted. The solution is to either go through the list backwards, or to make the loop like this:
<br />
while(lbx.GetCount())<br />
{<br />
Data* p = (Data*)lbx.GetItemDataPtr(0);<br />
<br />
<br />
lbx.DeleteString(0); <br />
}<br />
|
|
|
|
|
This is buggy - you want to do DeleteString(0) not DeleteString(i) since GetCount() will return you smaller values each time you call DeleteString() .
Or as has already been pointed out, you can just use ResetContent() .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|