|
Hello, the codegurus around the world.;)
When you use the standard C++ code with socket,
the code depends on OS library.
1) Windows -> WinSock or WinInet (FTP, HTTP)
2) Linux and Unix -> Berkley socket library.
3) Mac maybe has some library.
So, I don't think that we can write the socket code compatible with all OS
by C++.
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
Take a look at ACE library.
Unlike Java, C++ does not have network support in the standard library (which is a good decision, IMHO)
I vote pro drink
|
|
|
|
|
I am trying to set a dialog's font during WM_INITDIALOG but it is not working. E.g.
BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
HFONT hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
SendMessage(hwnd, WM_SETFONT, (WPARAM)hfont, (LPARAM)TRUE);
if(SendMessage(hwnd, WM_GETFONT, 0, 0) != hfont)
MessageBox(hwnd, "WTF", NULL, MB_OK);
return TRUE;
}
I know I have to send the WM_SETFONT message to the controls also (that part is working). Does anyone have any idea what's wrong?
|
|
|
|
|
You don't send WM_SETFONT messages yourself. Set the DS_SETFONT style of the dialog (you may have to edit the .RC file manually, I forget if that style is in the resource editor) and the OS will handle the WM_SETFONT stuff itself.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
May be this will be OK for you: http://www.codeguru.com/dialog/ChangeDefaultDialogFont.shtml. I use this way in my application, it works.
|
|
|
|
|
Hi.
I am to the point where I can solve a problem using C++ "low-level" (i.e dynamic memory allocation) and "high-level" (i.e. using the string and STL container). Experienced programmers, even Stroustrup, recommend using library tools like string when possible because them are optimized.
First, what is the point of programming if almost everything is done for you and all you have to do is put the pieces together?
Under what circumstances do you prefer low-level C++ over high-level C++, and vic versa?
Hey, do not get me wrong. Based on my experience, C++ library tools (strings and STL) are unparalleled. I find using C++ library tools speeds up my programs, and they serve as the "missing" pieces to solutions to various programs especially when dealing with istream and ostream.
I fear that relying too much on C++ standard library will cause the programmer to lose sight of the big picture and begin to forget the low-level stuff. Does that happen to you? Thus, I try to implement C-Style when possible.
Kuphryn
|
|
|
|
|
Using the C++ standard library allows you to work more so on the problem, not the implimentation. You spend less time working on broiler plate code (memory management, algorithms, etc.).
I try to stay well versed in both. Always choose the best tool for the job.
|
|
|
|
|
|
I need to implement file dragging from a list control to the explorer. Is anyone able to outline what I need to do? (i.e. messages etc)
Thanks
|
|
|
|
|
|
I've an MDI app with two different html views and when I dynamicaly change content of first view, with for example:
CComPtr <IDispatch> pDisp = GetHtmlDocument();
if (pDisp)
{
CComQIPtr <IHTMLDocument2> pHtmlDoc2;
pHtmlDoc2 = pDisp;
if (pHtmlDoc2)
{
// ...
// some code here
// ...
}
}
and then I try to do something similar in second view, GetHtmlDocument() returns NULL. I don't know why? Please help.
Best regards
r2-r
|
|
|
|
|
hi- any body helps me
i want to make an application which will stop explorer popup adds.like popkiller.com noads.exe.
i am using vc++ 6 windows 2000.
Please Give an idea not code
Ibrar Ahmad
Softare Engr.
Comcept PVT LTD.
Islamabad
abrar_@yahoo.com
|
|
|
|
|
write it as an http proxy and deny the popup-ads
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I have write this but its not good for doing lot of work on small problem.It should filter entire conents so it slow down net speed.Look at popup add filetr.noadds they dont write any proxy but works fine.there size are just few k
Ibrar Ahmad
Softare Engr.
Comcept PVT LTD.
Islamabad
abrar_@yahoo.com
|
|
|
|
|
Writing a popup window killer is quite easy - write a browser helper object. IE creates an instance of all BHOs when a browser window is created. Your BHO can check the window properties, and make a judgement based on them. For instance, if there's no menu, toolbar, and status bar, chances are it's an ad window, so your BHO can close the window.
Doing good ad filtering requires a proxy so you can intercept the HTML and remove <img> tags and whatnot.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
How about writinng a BHO that intercepts all OnNewWindow and kills them unless the user specificliy asks to open in a new window. Don't know how the examples you used works, but it is probably some kind of logic depending on how the window created looks like (status bar, explorer bar, document contains only one link and an image...)
/moliate
|
|
|
|
|
can u give me some sample code i am new for ie programming
Ibrar Ahmad
Softare Engr.
Comcept PVT LTD.
Islamabad
abrar_@yahoo.com
|
|
|
|
|
First, create an ATL_COM project, using the AppWizard. Add a new ALT object, and change the implementation so it supports <code>IObjectWithSite</code>. The code will look something like this:
<pre>
class ATL_NO_VTABLE CIEHelp :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CIEHelp, &CLSID_IEHelp>,
public IObjectWithSiteImpl<CIEHelp>, // Add this <H>
public IDispatchImpl<IIEHelp, &IID_IIEHelp, &LIBID_KILLPOPUPLib>
{
....
BEGIN_COM_MAP(CIEHelp)
COM_INTERFACE_ENTRY(IIEHelp)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY_IMPL(IObjectWithSite) // ... and this. <H>
END_COM_MAP()
....
</pre>
Then override <code>IObjectWithSite::SetSite</code> and <code>IDispatch::Invoke</code>. SetSite will get you a pointer to the <code>IWebBrowser2</code> interface, and allow you to <code>Advise</code> to get events. Invoke is where the events go. If you find a new window opening, kill it.. You can switch the DISPID parameter and look for <code>DISPID_NEWWINDOW2</code>. When you got an event you can get the IE instance like this:
<pre>
// in IDispatch implementation
switch(dispidMember)
...
case DISPID_NEWWINDOW2:
IWebBrowser2* pIE;
if (pDispParams->cArgs > 0 && pDispParam->rgvarg[0].vt == VT_DISPATCH)
{
//else we have an error <H>
HRESULT hr = CoCreateInstance(CLSID_InternetExplorer,
NULL,
CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2,
(void**)&pIE);
hr = pIE->put_RegisterAsBrowser(TRUE);
hr = pIE->get_Application(pDispParam->rgvarg[0]);
// do stuff, like looking at browser properties, document properties
// and so on, and if the new window is unwanted:
hr = pIE->Quit();
//cleanup
}
break;
</pre>
Finally edit the Registry script to register as a BHO. The rgs file will look something loke this, just edit names and GUIDS:
<pre>
HKCR
{
IEHlprObj.IEHlprObj.1 = s 'IEHlprObj Class'
{
CLSID = s '{CE7C3CF0-4B15-11D1-ABED-709549C10000}'
}
IEHlprObj.IEHlprObj = s 'IEHlprObj Class'
{
CurVer = s 'IEHlprObj.IEHlprObj.1'
}
NoRemove CLSID
{
ForceRemove {CE7C3CF0-4B15-11D1-ABED-709549C10000}
= s 'IEHlprObj Class'
{
ProgID = s 'IEHlprObj.IEHlprObj.1'
VersionIndependentProgID = s 'IEHlprObj.IEHlprObj'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
}
}
}
HKLM
{
SOFTWARE
{
Microsoft
{
Windows
{
CurrentVersion
{
Explorer
{
'Browser Helper Objects'
{
{CE7C3CF0-4B15-11D1-ABED-709549C10000}
}
}
}
}
}
}
}
</pre>
I havn't tested any of the code, but hope it will get you on your way. There are probably lots of tutorials on BHOs if you run into any problems...
/moliate
|
|
|
|
|
Hi,
In my SDK application i want to add a set a strings to a ListBox . I'm searching for a set of files from a directory and i want to add those files to the list box. How can i solve it.
vini
|
|
|
|
|
Check out LB_ADDSTRING and LB_INSERTSTRING
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I don't know how to go to the URL from the program.
As I am the Beginner, I knew basic syntax of C++. However, I do not have the concept of internet programming.
My question is:
When I write the C++ program based on MFC, I want to click the button so that the browser will open automatically and go to the specific URL. I think it is not difficult but I spent much time on it. (This is such like the function "help" of most software program. When the user clicks on the "help" button, the browser is opened and go to the URL) Can anyone help?
Thank you.
Dicky
|
|
|
|
|
Use ShellExecute to run the default browser:
ShellExecute ( hwndYourWindow, "open", "http://xxx.yyy.com/help.html", NULL, NULL, SW_SHOW );
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I've designed the interface to my application in the following manner:
To the left of the application main window are 5 buttons, placed vertically (Button1,Button2 etc). Each button have an associated property sheet.On clicking each button ,it should open its corresponding property sheet within the right hand side of the application window.But the following code displays the property sheet in a new window.
// OnClickButton1 function
// a property sheet is created with two tabbed controls tab1 and tab2
PropertySheet prop1("Option1");
CTab1 Tab1; // CTab1 is derived from PropertyPage
CTab2 Tab2; // CTab2 is derived from PropertyPage
prop1.AddPage(&Tab1);
prop1.AddPage(&Tab2);
prop1.DoModal();
How can i modify the code in such a way that the property sheet opens within the right side of the main window rather than in a new window? ie,the main window should contain the property sheet or the property sheet should not have the titlebar..please help me..
anish
|
|
|
|
|
|
What do you mean by that?
All processes will have their own current directory.
If you mean the shell, then the default directory is the desktop [not 100% sure abt this though]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|