|
If that ip address is stored as a member variable of some class in utility.cpp, then you can just create a member function to modify it. If it is a global variable, just make sure it is declared with extern in the file that you want to access it. Again, post some code for the ip address part in utility.cpp if possible.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
-- modified at 0:16 Friday 26th August, 2005
|
|
|
|
|
// utility.cpp -- contains stuff used by more than one thread
#include <stdafx.h>
#include "utility.h"
CString g_strServerName;
//The IP address in the following line is to be changed to that of the machine
//in which the Server is installed.
CString g_strServerIP = "192.0.3.109";volatile UINT g_nPort = 1500;
BOOL g_bConnected = FALSE;
BOOL g_bServerClosed = TRUE;
char *g_cRequest;
CBlockingSocket g_sClient;
CEvent g_eventKill;
that line already set is as that ip.. i wanna declare a variable in the main dialog.cpp then throw the value over.. is it possible.. thank alot
|
|
|
|
|
Ok since g_strServerIP is a global and you want to access it in dialog.cpp, then you need to put this line there:
extern CString g_strServerIP; Now in your dialog.cpp you can access it to change the value:
CString sNewIP = "255.255.255.255"
g_strServerIP = sNewIP;
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
thanks.. i try it and compile.. no error..
i add in
#include "stdafx.h"
#include "ChatClient.h"
#include "ChatClientDlg.h"
#include "utility.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
extern CString g_strServerIP;#endif
and at a button..
void CChatClientDlg::Onipcon()
{
CString str;
m_IpCon.GetWindowText(str);
g_strServerIP=str;
}
it should work right!
but problem the moment the program started it retrive the ip from the uility and if there no fix ip.. the program freeze up although it can compile but i cant connect to the server..
|
|
|
|
|
cue_ball wrote:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
extern CString g_strServerIP;#endif
Don't put it inside the #ifdef tags.
cue_ball wrote:
the moment the program started it retrive the ip from the uility and if there no fix ip.. the program freeze up
Check your connect function. Run a debug and see how or where it freezed.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
ACTUALLY IT DIDNT FREEZE UP..the whole program still run but.. but when i key in my ip it didnt work..
i tink it because the compiler run though the uility first hence .. it "jam" the program because it cant find any ip address.. cos at the point of start it is a unknow number
|
|
|
|
|
i build a app. its view is drived chtmview, and it can explore internet. but i want chang the content in chtmview, when i open a html page. for example, i want show the datas that are from database in view. how can i do?
|
|
|
|
|
Hello
You can use GetHtmlDocument() method to get IDispatch interface of HTML document object. Then you can query interfaces of your interest: IHTMLDocument2 , IHTMLDocument3 . With these interface you can access entire HTML document. Look at MSDN. All these MSHTML interfaces are documented pretty well.
Andrew
|
|
|
|
|
|
Just wanted to comfirm, is it true that characters like '>' or '<' can't be passed as command line arguments? I have a main function to take in parameters. However, it seems that characters like '>', '<' can't be passed in. e.g.
abc.exe 9000
abc.exe >9000
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
me think that < or > are used as indirection for the command parser ( dos ).
for example,
dir > qq.txt
will put the result of the dir command in the qq.txt file.
if you want to put < or > in a parameter, you could enclose it in "
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
me think that < or > are used as indirection for the command parser
Yeah, i would think so.
Maximilien wrote:
if you want to put < or > in a parameter, you could enclose it in "
Thanks.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Instead of arguments use the command line itself and parse it using your own code.
GetCommandLine provides you with the raw command line.
Elaine
The tigress is here
|
|
|
|
|
Mine is a console application. No windows api involved. Too bad.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Weiye Chen wrote:
Mine is a console application. No windows api involved.
You can still call Win32 API's!!! Like GetCommandLine.
And, BTW you *can* create a "windows" even in a commandline program, JFYI!
|
|
|
|
|
ahz wrote:
You can still call Win32 API's!!! Like GetCommandLine.
Oops, i forgot to mention the program will be deployed on a unix environment.:->
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Can give me example of source code of a dialog? I want some example that when I click on a button, it will automatic send a hello message.
|
|
|
|
|
ON_BN_CLICKED( IDC_MYBUTTON, OnMyButtonClicked )<br />
...<br />
void MyDialog::OnMyButtonClicked()<br />
{<br />
AfxMessageBox("Hello Message" );<br />
<br />
}
or something to that effect.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
AfxMessageBox("Hello Message" );
Assuming he wanted to send the hello message to the screen.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
AfxMessageBox("Hello Message" ) is appear a message box in the screen right? But I just want a message to print out on the screen not a message box
|
|
|
|
|
Try to use TextOut() function with reference to window rect coordinates from GetWindowRect() ...
I did not try it out ...but this should work
redindian
|
|
|
|
|
Can give some example of source code on the function that you suggest?
|
|
|
|
|
|
|