|
Hi,
I am trying to modify some ISAPI code. for getting the domain name I use the GetServerVariable() call and pass "HTTP_HOST" and then parse the string(the host name). The problem is that for our internal environment, people type things like
"http://internal1"
This will take them to the correct URL.
Unfortunately the GetServerVariable with "HTTP_HOST" is returning "internal1" as the name. Its not giving the fully qualified domain name. Is there any way I can get the fully qualified name (eg: http://internal1.somedomain.com)?
Or do I need to use some WinSock functions? if yes which one?
Thanks in advance..
Madhu
|
|
|
|
|
I'm trying to build 2 apps in VC++6: one that writes character strings to a serial port (COM2) and one that reads them on another port (COM1). I'm running both apps at the same time, have the two serial ports connected with a NULL modem serial cable. Each app works fine by itself when I link the PC to a separate device through the serial cable.When I link COM1 and COM2, the writer app writes characters to COM2, but the reader app fails to read them on COM1. I'm not using any flow control. What am I doing wrong?
Any help is greatly appreciated.
|
|
|
|
|
For starters, make sure you have hardware flow control turned off in Hyperterminal. Unless you're sure that your cable is wired correctly to make that work, turning off all flow control will at least take that out of the equation.
|
|
|
|
|
Maybe you must use overlapped I/O.
Try this @ home. (B&B)
|
|
|
|
|
This is some standard code I use with serial ports:
DWORD dwNumBytesRead ;
DWORD dwNumBytesWritten ;
SECURITY_ATTRIBUTES sa ;
char szInputBuffer[2] ;
char szString[80] ;
int iStringIndex = 0 ;
int lamp_warming_timer ;
int lamp_on_timer ;
CString text ;
sa.nLength = sizeof(SECURITY_ATTRIBUTES) ;
sa.lpSecurityDescriptor = NULL ;
sa.bInheritHandle = true ;
m_hSerialPortHandle = CreateFile((LPCTSTR)m_csCommPortName,
GENERIC_READ | GENERIC_WRITE,
0,
&sa,
OPEN_EXISTING,
0,
0) ;
if (m_hSerialPortHandle != INVALID_HANDLE_VALUE)
{
m_bOpen = true ;
if (!GetCommState(m_hSerialPortHandle, &m_DCB))
{
text = "Serial port DCB failure." ;
::SendMessage(m_hwndParent, UWM_UC_STATUS, (LONG)(LPCTSTR)text, 0) ;
}
else
{
m_DCB.BaudRate = CBR_9600 ;
m_DCB.ByteSize = 8 ;
m_DCB.Parity = NOPARITY ;
m_DCB.fParity = false ;
m_DCB.StopBits = ONESTOPBIT ;
m_DCB.fDtrControl = DTR_CONTROL_DISABLE ;
m_DCB.fOutxCtsFlow = false ;
m_DCB.fDsrSensitivity = false ;
m_DCB.fTXContinueOnXoff = true ;
m_DCB.fOutX = false ;
m_DCB.fRtsControl = RTS_CONTROL_DISABLE ;
m_DCB.fAbortOnError = false ;
if (!SetCommState(m_hSerialPortHandle, &m_DCB))
{
text = "Serial port set com status failure." ;
::SendMessage(m_hwndParent, UWM_UC_STATUS, (LONG)(LPCTSTR)text, 0) ;
}
if (!SetCommMask(m_hSerialPortHandle, EV_RXCHAR))
{
text = "Serial port set com mask failure." ;
::SendMessage(m_hwndParent, UWM_UC_STATUS, (LONG)(LPCTSTR)text, 0) ;
}
COMMTIMEOUTS timeouts ;
timeouts.ReadIntervalTimeout = MAXDWORD ;
timeouts.ReadTotalTimeoutConstant = 0 ;
timeouts.ReadTotalTimeoutMultiplier = 0 ;
timeouts.WriteTotalTimeoutConstant = 0 ;
timeouts.WriteTotalTimeoutMultiplier = 0 ;
SetCommTimeouts(m_hSerialPortHandle, &timeouts) ;
}
}
else
{
text = "Unable to open serial port \"" + m_csCommPortName + "\"" ;
::SendMessage(m_hwndParent, UWM_UC_STATUS, (LONG)(LPCTSTR)text, 0) ;
m_bThreadDead = true ;
return ;
}
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
|
I am using the CSizingControlBar class in my application and I don't know how to change the width of the control. I tried SetWindowPos, but that didn't work. How do I change its width?
-- Steve
|
|
|
|
|
Have you tried here[^], it contains most of the info' on that subject.
Cheers
Kannan
|
|
|
|
|
Good luck ...
I've been trying to do this myself, and I can't really do it; there's a post in the archive section of the datamekanix ( see other answer ) that tells you to do something like :
void CMyBar::SetWidth(const int nWidth)
{
if (IsFloating())
m_szFloat.cx = nWidth;
else if (IsHorzDocked())
m_szHorz.cx = nWidth;
else
m_szVert.cx = nWidth;
m_pDockSite->DelayRecalcLayout();
}
but I was never able to make it work
|
|
|
|
|
hello everybody
I need some help with declering an pointer to my clss
my class of CFromView in there i have a function class LoadImages
<br />
class CTestView : public CFormView<br />
and i have a different class and object some where else and i want to point to this class where i double click my control
and load my images
<br />
CTestView *pView = (CTestView *)((CFormView *)AfxGetApp()->m_pMainWnd)->GetActiveWindow();<br />
I new at this MFC Visual C++ program
can any one please help me
thanks...........
|
|
|
|
|
I think it's AfxGetMainWnd()->GetActiveView(). you only need to cast to CTestView*.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
|
CMainFrame * pMain = (CMainFrame*) AfxGetMainWnd();
pMain->GetActiveView();
Sorry, I abandoned MFC a long time ago.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
It's ok thanks for trying
in my program the is no GetActiveView() i keep getting an error.
maybe i'm putting this in the wrong way
this is what i have
CTestView * pView= (CTestView*)AfxGetMainWnd();
and lets say i want to call and function or an object like
this
pView->m_cThumbFrame.Add("picture.bmp");
but this dosen't work ((
|
|
|
|
|
E3 wrote:
in my program the is no GetActiveView() i keep getting an error.
After the cast ? Compiles fine here.
E3 wrote:
CTestView * pView= (CTestView*)AfxGetMainWnd();
Won't work. You'll get the CMainFrame class, which when cast has a GetActiveView() method.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
It would be better to store the view-pointer for each view in a own variable to ensure you getting the right view pointer.
If not you are to crush and not to know why.
(If you do´t do this than check with the CObject::IsKindOf or something that the pointer is a object type of the class)
Try this @ home. (B&B)
|
|
|
|
|
I find it easier to store a pointer to the CView derived class in my CWinApp derived class. This guarantees that I'm working on the correct view.
Assuming you are calling your function from your CFrameWnd derived class, you may be able to use GetActiveView and cast it to the CTestView.
I prefer the first method but then I tend to have a lot of CView classes in my projects.
Michael
Fat bottomed girls
You make the rockin' world go round -- Queen
|
|
|
|
|
thank you all for helping me... I finaly got the some of a b.... to work hehehe
here is what i did to get it working for all those people who mite get stuck on this and are new like me.
<br />
<br />
CFrameWnd* pFrame=(CFrameWnd*)AfxGetMainWnd();<br />
CTestView *p = (CTestView *)pFrame->GetActiveView();<br />
p->LoadImages(str);<br />
<br />
<br />
and this get the current CFormView window and everything works.....
thanks all guys....for all your help ;)
E3
|
|
|
|
|
Gurus!
I am working on a Doc/View SDI Application, The view is FormView, it has a CPropertySheet which has two Property pages. Now in some scenarios when something in the document changes, i need to re-populate some controls in those property pages. I was thinking of posting some private messages in the Document and catch those messages in the Property pages, but couldn't work it out.
Could you send me some code snippet how to implement it and is this the right approach of doing it.
Please reply asap.
TIA
|
|
|
|
|
You can not send messages directly to property pages. You need the handler in the sheet.
Anyway, if your document changes and you want to notice the views(s) UpdateAllViews() is the way to go. You can send a private "magic number" with it as a Hint, and all Views of your document get this (Via OnUpdate() ).
The Views in turn hand any notification down to their children e.g. a CPropertySheet , or they query the property sheet for the active page and work with that.
With all this, be sure that you do NOT duplicate data that you have in the document! Have the pages show the documents data, not the document send its data to the pages for duplicate storage!
You get in all kinds of inconsistency troubles if you try (and inevitably fail) to do so.
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
Thanks jhwurmbach for your advise,
I actually need to pass a hint actually, on which propretypages need to reload them with the data.
Thanks again for the adivse.
|
|
|
|
|
Hi y'all! Can anyone tell me how to create an EditWordBreakProc function for Word Wrap
option in Win32 application ?
|
|
|
|
|
Hello,
I have 2 status bars in my SDI app.. The second status bar is only displayed when specific functions are ran and it's displayed right above the standard status bar at the bottom.. is there a way I can take the gripper off of the top status bar.. it looks really bad having 2 grippers.. I have tried to ~SBARS_SIZEGRIP on the bar style but it doesn't work.
Any ideas?
Rob
|
|
|
|
|
You have to derive a new class and set the ~SBARS_SIZEGRIP in its precreatewindow().
Search MSDN and you will find it. It is a bug.
Hari Krishnan
|
|
|
|
|
0 errors, 0 warnings.
why?! why?! why!! ! ! !
anyone want to get email and try to help me solve this?? I got an evil mysterious bug.
Ive tried 3 seperate file handling libraries , I dont even think its a file handling problem anymore. compiles and links fine, but its getting a microsoft send / dont send error dialog and crashing.
argh!!!
|
|
|
|