|
Mmmm...
Ok !, I remember I think you have to add this code in your InitInstance method from the APP:
AfxInitRichEdit();
Funny isn´t it ? ( I think I had one time that problem it´s a sh...), Bye !
Braulio
|
|
|
|
|
This is the point :at this case you don't need to add AfxInitRichEdit() anywhere
(you do not add richedit in resources tab)
1.Define controller in header of class--->CRichEditCtrl richedit;
2.In OnCreate or OnInitDialog you create richedit---->
richedit.create(.........);
|
|
|
|
|
Hi guys,
In my MFC application, I'm using an IRC layer to make remote machines connecting into a group and exchanging data.
I send some WHO commands in order to get the addresses of the remote machines.
Sometimes, the IRC server replies with an IP Address (123.123.123.123) and sometimes with a Domain Name (this.is.my.domain) but never both. I store the result into a string. I need to get both IP Address and Domain Name, or at least the IP Address if the Domain Name is not accessible.
How do I:
- detect if the format I get is an IP Address or a Domain Name,
- convert an IP Address to a Domain Name,
- convert a Domain Name to an IP Address.
Thanks a lot in advance for your help...
Jean-Louis
|
|
|
|
|
Here's a piece of code I used some time ago:
ULONG uRemAddr = inet_addr(lpszHostAddress);
if (uRemAddr == INADDR_NONE) {
hostent* pHE = gethostbyname(lpszHostAddress);
if (pHE == 0) {
m_lastError = WSAGetLastError();
return FALSE;
}
uRemAddr = *((ULONG*)pHE->h_addr_list[0]);
}
The address is in lpszHostAddress , at the end the IP address (as a 32bit unsigned number) is in uRemAddr . You can use the getnameinfo() function to get the host name from the IP address.
|
|
|
|
|
Thanks a lot man! That saved my day...
|
|
|
|
|
Hello, i was confused by a question for a
long time.i am making
a program that contains a dialogbar. i create
it in a class(CMyDialogbar) with 6 buttons.
and i want these buttons have push style just
like MSPaint's toolbox.and now i create a new
class named CPushButton extend from CButton.
then i call CPushButton::Create(...) to create
a button, but when i compile this program, the
button in the dialogbar still gray.it doesnt
work at all. i look up MFC Libary Reference to check
the parameters i passed to CPushButton::Create(..),
they are all right!i dont know what to do next!
can anybody give me some suggestion?
or ,is there another way to solve this problem??
how can i implement these button ?? and make them
have push button style ????
it almot drived me mad !!!thank in advance!
Thank u 4 helping me!!!!! Thank u !!!!
Codeproject
|
|
|
|
|
The buttons are probably disabled because there are no command or UI handlers.
Check out the macros ON_COMMAND and ON_UPDATE_COMMAND_UI.
If you have an ON_COMMAND handler you do not need the UI handler to enable the button.
If you want to have a pushbutton, call CButton::SetButtonStyle() with nStyle as BS_PUSHBUTTON.
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
Thanks a lot, i ll have a try.
thx
nickong
Codeproject
|
|
|
|
|
I downloaded TAPI3.0 sample incoming from MSDN. The trouble is I cannot compile it. It requires nmake usage. The instruction only says type in nmake in the directory where you have this sample unzipped. It is supposed to compile t3in. I tried this in command prompt and it did not work. I am new to C++ and cannot find any place where I can type 'make' within project or its tools.
Could somebody help me understand how nmake can be used in this situation.
|
|
|
|
|
Do you remember when you installed Visual Studio whether or not you opted to let the installer add VC to your path? This could be the problem. nmake.exe is located in:
C:\Program Files\Microsoft Visual Studio\VC98\Bin\NMAKE.EXE
on my installation. You can add this path to your PATH environment variable so that it's available on the command line and then run nmake in the TAPI directory.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I create C++ modeless dialog from an Active X control.
When an ActiveX control is the parent window of a modeless dialog box the TAB key, ToolTips don't work as expected.
The problem with the TAB key could be solved using ::SetWindowsHookEx function, though it is quite dangerous.
But I still can't enable tooltips.
Ruslan
|
|
|
|
|
I have been trying to resolve this problem all morning. I'm running WinXP and have VC++6 SP5 with the latest PSDK installed, and I don't know what I'm doing wrong. I am trying to dump into a buffer a HTML file but keep getting this error:
CFile exception: accessDenied, File Unknown, OS error information = 5.
First-chance exception in WebServer.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
I have tried stepping through it and looking at msdn.microsoft.com (what a joke) for the error message and the steps to resolve it but can't find anything. Here is a code snippet and let me know if I am doing something wrong.
CFile SendFile;
if (!SendFile.Open("c:\\wwwroot\\index.html", CFile::readOnly|CFile::shareDenyWrite|CFile::typeBinary))
return -1;
DataLeft=SendFile.GetLength();
SendFile.Read(SendData, (UINT)DataLeft);
I have tried using the CFile Open method and the overloaded constructor to open this file and read it, but to no avail. It opens fine, but when reading in the document I get the exception noted above.
The error is thrown at the call to the Read method. Anyone know what's wrong? I am baffled and my brain is about to fry. This is part of a webserver I'm writing as a hobby project and one I'll post to the site when I can get bare minimums working (that is if anyone is interested)
HomeNuke
----
"Nuke'd Your Home, Yet?"
Run your own PostNuke based web server from home
http://www.homenuke.com
|
|
|
|
|
Get rid from CFile::typeBinary . You cannot use it with CFile , only with derived classes
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
ooops...hehe shows you how desperate I am.
This is one variation of code I was trying just to see if that was the problem because the error message was unknown file. I have removed and have tried it without the CFile::typeBinary but still get the same error.
Remember to remove 'I am stupid' code before submitting
HomeNuke
----
"Nuke'd Your Home, Yet?"
Run your own PostNuke based web server from home
http://www.homenuke.com
|
|
|
|
|
Hmm, try to set CFile::modeReadWrite and remove the share thingy, also did you check this on other files? That are not in the IIS web server directory? Check the Windows permissions of this folder also, sometimes IIS won't let "strangers" to touch its files
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
OK this is weird...hard to explain but here is the new source code I used to get it to work, and thanks for your help, because I have tried your suggestions and you have responded really quickly. Also just to clarify things I just used wwwroot as a directory for web objects since this is a directory IIS and Apache use, I don't have either of them installed, I just created that directory.
But, enough of the rambling Here is the new source code:
if (!SendFile.Open"c:\\wwwroot\\index.html",CFile::modeRead|CFile::shareDenyNone))
return -1;
DataLeft=SendFile.GetLength();
SendFile.Read(SendData, (UINT)DataLeft);
Start=0;
I change CFile::readOnly to CFile::modeRead...I'm looking up the docs now to figure out why this one works?!?! Maybe CF::readOnly is for an inherited class? But at least we where able to solve this.
Thanks for your help PHILIP!!!
HomeNuke
----
"Nuke'd Your Home, Yet?"
Run your own PostNuke based web server from home
http://www.homenuke.com
|
|
|
|
|
My bad LOL, I didn't pay attention to this too, and this is funny
Well, CFile::readOnly is used.... for attribute of the file! You know, like Hidden, ReadOnly, etc. And the value of it is same as.... CFile::modeWrite!! LMAO, so at the end it is trying to read from file opened on;y for writing.
LMAO
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Could some one please give some light on this for me.
i would like to add a bitmap to a button on a dialogbar, i know that i need to use the SetImage() on the variable of the button but the problem is that the bitmap will not show when the program runs.
i have tried placing the code on the OnCreate function located in the MainFrame just after the dialogbar is created and in the constructor of the dialogbar class, to no luck.
can someone please give me some help to place this code in the right place.
|
|
|
|
|
Declare a CBitmapButton and then subclass the button you have in your dialog bar. Check out the CBitmapButton members SubclassDlgItem() and LoadBitmaps().
E.g.
CBitmapButton yourBitmapButton;
yourBitmapButton.SubclassDlgItem(IDC_YOUR_BUTTON, this);
yourBitmapButton.LoadBitmaps(_T("BUTTON_BMPN"),
_T("BUTTON_BMPD"),
_T("BUTTON_BMPF"),
_T("BUTTON_BMPN"))
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
I am having a problem with non-overlapping child windows in an application that is non SDI or MDI. I am able to create 2 child windows in the parent window.(very much like splitter windows, but I have not used splitter windows, since I have other problems with it). However, when I try to popup a dialog box, it goes into a "loop", trying to figureout which window is on top, and trying to send some message such as OnPaint()to it.
Thanks,
raghu
|
|
|
|
|
..., how?
For example, I have a IWebBrowser2 control in my application, I want to replace some (read - any) image in HTML page with my image in memory.
I know, I can replace (load) HTML code itself from memory (using IStream ), but what about images and other things (Flash, sounds - all should be same I guess)?
If someone knows the answer, or maybe a hint, place where to look and what to look for, please answer.
Thanx,
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
How do I read pixel data from a series of 2D images using openGL. I need to use the 2D slices to reconstruct a 3D model. Any suggestions on how to proceed?
|
|
|
|
|
I have just finished making a dll that all my programs will lnk to, i want to make an appwizard so that the dll is automatically put into the same folder as the project, but when I went to create the appwizard, the option was not on the list (vc++6). I recently reformatted my C drive and installed vs.
I swear I could do that before.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Did you re-install the Service Pack?
- Greatest invention : "The Microchip!"
|
|
|
|
|
Hi
I've written a shell extension that uses the undocumented features described by Henk Devos in his excellent article here on cp. I use ShellCreateFolderViewEx.
Everything is fine when 2000 is the os, but on XP, I must select entries with different heights in the tree control to force an update. If I select sibling items, nothing is updated. Anyone who has had this problem (and solved it)?
|
|
|
|