|
Your welcome.
Regards,
Brian Dela
|
|
|
|
|
I'm using the CreateFontDirect and trying to set the Point size of the height of the font and then display it. I'm using a map mode of MM_LOMETRIC, but the size is not the same as word diplays it. It works fine if the map mode is MM_TEXT.
Thanks
|
|
|
|
|
I need to create a program that will keep a list of folders synchronized, on-demand, between a number (10+) of computers on the internet. At a function call, I need a computer to be able to connect to the other computers and find and download the latest version of a specific folder. It also needs to use as little bandwidth and CPU as possible, because the computers with be also running game servers (this progam will interface somewhat with the game server, also).
Now, how should I go about doing that? I have zero experience in any network programming, but with all the articles here, I don't think it would take me too long to learn. Currently, I'm considering having a small http server and a http file download client on each computer, since that seems the simplest.
Thanks!
|
|
|
|
|
One soluton is winsock. Design your own server/client for custom system file synchronization.
Kuphryn
|
|
|
|
|
|
What's wrong with this function i used to find text in an edit control? I don't understand, it should work:
//CFindReplaceDialog FindDlg pre-defined
if (FindDlg->FindNext())
{
CString data;
GetDlgItemText(IDD_EDIT, data);
int FindIndex = data.Find(_T(FindDlg->GetFindString()), FindStart);//int FindStart global variable
if (FindIndex > -1)
{
FindStart = FindIndex + FindDlg->GetFindString().GetLength();
CEdit *edit = (CEdit *) GetDlgItem(IDD_EDIT);
MessageBox("testing...");
edit->SetSel(FindIndex, FindStart, FALSE);
}
else
{
MessageBox("The text you entered was not found.", "Text not found", MB_ICONINFORMATION);
}
}
What could be wrong with this code?
-- Steve
|
|
|
|
|
Make sure that FindStart has a valid value in it (set it to 0 or -1 and see if that helps).
The line
int FindIndex = data.Find(_T(FindDlg->GetFindString()), FindStart);
doesn't need the _T() (_T() is only used for string literals), but it won't make a difference unless you're compiling for unicode:
int FindIndex = data.Find(FindDlg->GetFindString(), FindStart);
Step through the code one line at a time and see what all your variables are after each statement. The code logic looks fine, so it should work.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
It should work, and the toolbar responds that something is selected, but there is no selection and the edit control refuses to accept any messages. The cut, copy, and paste features in my program refuse to work after a search. I've never seen this problem before.
-- Steve
|
|
|
|
|
Well,
while working on a class i am facing a really bad problem! well, i just cant get it!
i just run the following code
<br />
BOOL COpenGLWindow::CreateOpenGLWindow(RECT Rect,char* WindowCaption,bool Fullscreen,int Bits,UINT ExStyle,UINT Style,HWND Parent)<br />
{<br />
WNDCLASS WndClass;<br />
WndClass.style=CS_VREDRAW|CS_HREDRAW|CS_OWNDC;<br />
WndClass.lpfnWndProc=OpenGLWndProc;<br />
WndClass.cbClsExtra=0;<br />
WndClass.cbWndExtra=0;<br />
WndClass.hInstance=GetInstHandle();<br />
WndClass.hIcon=::LoadIcon(NULL,IDI_WINLOGO);<br />
WndClass.hCursor=::LoadCursor(NULL,IDC_ARROW);<br />
WndClass.hbrBackground=0;<br />
WndClass.lpszMenuName=0;<br />
WndClass.lpszClassName="OpenGLClass";<br />
if(!RegisterClass(&WndClass))<br />
{<br />
OutputDebugString();<br />
return FALSE;<br />
}<br />
bool ShowWnd=(Style&WS_VISIBLE);<br />
Style|=~WS_VISIBLE;<br />
if(!(hWnd=CreateWindowEx(ExStyle,"OpenGLClass",WindowCaption,Style,Rect.left,Rect.top,Rect.right-Rect.left,Rect.bottom-Rect.top,Parent,(HMENU)NULL,GetInstHandle(),NULL)))<br />
{<br />
OutputDebugString();<br />
return FALSE;<br />
}<br />
if(!(hDC=GetDC()))<br />
{<br />
OutputDebugString();<br />
return FALSE;<br />
}<br />
PIXELFORMATDESCRIPTOR pfd=<br />
{<br />
sizeof(PIXELFORMATDESCRIPTOR),<br />
1,<br />
PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER,<br />
PFD_TYPE_RGBA,<br />
Bits,<br />
0,0,0,0,0,0,0,0,0,0,0,0,0,<br />
24,<br />
0,0,0,0,0,0,0<br />
};<br />
int PixelFormat;<br />
if(!(PixelFormat=ChoosePixelFormat(hDC,&pfd)))<br />
{<br />
OutputDebugString();<br />
return FALSE;<br />
}<br />
if(!SetPixelFormat(hDC,PixelFormat,&pfd))<br />
{<br />
OutputDebugString();<br />
return FALSE;<br />
}<br />
if(!(hRC=wglCreateContext(hDC)))<br />
{<br />
OutputDebugString();<br />
return FALSE;<br />
}<br />
if(!wglMakeCurrent(hDC,hRC))<br />
{<br />
OutputDebugString();<br />
return FALSE;<br />
}<br />
if(ShowWnd)<br />
{<br />
ShowWindow(hWnd,SW_SHOW);<br />
SetForegroundWindow(hWnd);<br />
SetFocus(hWnd);<br />
}<br />
return TRUE;<br />
}<br />
and the call to CreateWindowEx Failes ! GetLastError() prints INvalid Window Handle.?!?!?!?
well the call bieing made to this function is as follows:
<br />
CreateOpenGLWindow(Rect,"Mine",false,16,WS_EX_APPWINDOW|WS_EX_WINDOWEDGE,WS_POPUPWINDOW,NULL);<br />
WEll i m in serious trouble so please help as soon as possible!
shoaib.
Doesn't Window Really Sucks!
|
|
|
|
|
Hi
My SDI program uses a CFormView derived class as View.I would like to know how i could change the view.What I mean is that when I click a button or a menu bar then I should be able to change the default view(which is a dialog) to another view(another dialog).Please Help
God is Love
|
|
|
|
|
here is the code using which u can chnage the view dynamically. i am assuming that u want the same Docuemnt to be associated with all views.
<br />
<br />
#define FIRST_VIEW 1<br />
#define SECOND_VIEW 2<br />
#define THIRD_VIEW 3<br />
<br />
<br />
void SelectView(UINT ViewID)<br />
{<br />
<br />
CView* pOld=GetActiveView();<br />
<br />
CView* pNew=(CView*) GetDlgItem(ViewID);<br />
<br />
if(pNew==NULL)<br />
{<br />
switch(ViewID)<br />
{<br />
case SECOND_VIEW:<br />
pNew=(CView*) new CSecondViews;<br />
break;<br />
<br />
case THIRD_VIEW:<br />
pNew=(CView*) new CThirdView;<br />
break;<br />
default:<br />
<br />
AfxMessageBox("Invalid ID");<br />
}<br />
<br />
<br />
<br />
<br />
CCreateContext context;<br />
context.m_pCurrentDoc=pOld->GetDocument();<br />
<br />
pNew->Create(NULL,NULL,0L,CFrameWnd::rectDefault,this,ViewID,&context);<br />
pNew->OnInitialUpdate();<br />
<br />
}<br />
<br />
SetActiveView(pNew);<br />
pOld->ShowWindow(SW_HIDE);<br />
pNew->ShowWindow(SW_SHOW);<br />
pOld->SetDlgCtrlID(m_CurrentViewID);<br />
pNew->SetDlgCtrlID(AFX_IDW_PANE_FIRST);<br />
m_CurrentViewID=ViewID;<br />
<br />
CDBase1Doc* pDoc=(CDBase1Doc*)GetActiveDocument ();<br />
pDoc->AddView(pNew);<br />
pDoc->RemoveView(pOld);<br />
<br />
RecalcLayout();<br />
}<br />
<br />
i hope this helps!!<br />
<br />
cheers!! ;)<br />
<br />
<br />
<br />
Muhammad Shoaib Khan<br />
http:
|
|
|
|
|
hi JaisonCodeMan!!
here is the code using which u can chnage the view dynamically. i am assuming that u want the same Docuemnt to be associated with all views.
<br />
<br />
#define FIRST_VIEW 1<br />
#define SECOND_VIEW 2<br />
#define THIRD_VIEW 3<br />
<br />
<br />
void SelectView(UINT ViewID)<br />
{<br />
<br />
CView* pOld=GetActiveView();<br />
<br />
CView* pNew=(CView*) GetDlgItem(ViewID);<br />
<br />
if(pNew==NULL)<br />
{<br />
switch(ViewID)<br />
{<br />
case SECOND_VIEW:<br />
pNew=(CView*) new CSecondViews;<br />
break;<br />
<br />
case THIRD_VIEW:<br />
pNew=(CView*) new CThirdView;<br />
break;<br />
default:<br />
<br />
AfxMessageBox("Invalid ID");<br />
}<br />
<br />
<br />
<br />
<br />
CCreateContext context;<br />
context.m_pCurrentDoc=pOld->GetDocument();<br />
<br />
pNew->Create(NULL,NULL,0L,CFrameWnd::rectDefault,this,ViewID,&context);<br />
pNew->OnInitialUpdate();<br />
<br />
}<br />
<br />
SetActiveView(pNew);<br />
pOld->ShowWindow(SW_HIDE);<br />
pNew->ShowWindow(SW_SHOW);<br />
pOld->SetDlgCtrlID(m_CurrentViewID);<br />
pNew->SetDlgCtrlID(AFX_IDW_PANE_FIRST);<br />
m_CurrentViewID=ViewID;<br />
<br />
CDBase1Doc* pDoc=(CDBase1Doc*)GetActiveDocument ();<br />
pDoc->AddView(pNew);<br />
pDoc->RemoveView(pOld);<br />
<br />
RecalcLayout();<br />
}<br />
i hope this helps!!
cheers!!
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
Hi
Thnaks for the reply Actually I made a function as you ahd mentioned in the mainfrm.cpp in my project and then called that function when i click on a amenu button.But it gave me an exception.Doesnt this function expect me to pass the value fo the diaog as mentione in the resource.h file??Also do i have to make a seperate class for each dialog that I want to make as the view of a document.or can i call any dialog.Please help
God is Love
|
|
|
|
|
JaisonCodeMan wrote:
Doesnt this function expect me to pass the value fo the diaog as mentione in the resource.h file??
The function which i haveshown expects only the no of View which u want to be there.. forexample FIRST_VIEW or what so ever it is...no it is not the identifier of the dialog as mentioned in resource.h.. it isjust the constant like FIRST_VIEW or SECOND_VIEW which ihave declared myself..
JaisonCodeMan wrote:
Doesnt this function expect me to pass the value fo the diaog as mentione in the resource.h file??
yes u need to have seprerate class for each dialog which u want to make as view of document.
cheers
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
how i can change the title of the application ?
|
|
|
|
|
simple!! SetWindowText()
cheers
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
If you want to change the title of an application that uses the Document/view framework then you will have to override PreCreateWindow and set the style to eliminate the WS_CAPTION property otherwise MFC automatically updates the application title to the file name which can be very frustrating!
See mike dunn's C++ FAQ here[^]
My world tour
What I do now..
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
|
|
|
|
|
i want to monitor for all incoming and outgoing TCP conenctions on some PC. which APIs to use?
NetMon apis?
or someone having experiecne in this plz guide me!!
Thanx
Shoaib
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
Is there a difference between this:
bool foo(int& a);
and this:
bool foo(int &a);
Thanks.
|
|
|
|
|
To you, the preprocessor, or the compiler? Where you put spaces, and how many you put, is irrelevant to the compiler as the preprocessor removes them all before sending the tokens to the compiler.
Take something like:
#include < stdio.h >
int main( int argc, char **argv )
{
printf("Hello World!\n");
return 0;
} You could have just as easily written it as:
#include < stdio.h >int main( int argc, char **argv ){printf("Hello World!\n");return 0;}
The compiler wouldn't have cared.
|
|
|
|
|
No, however int& is preferable because it makes it clear that the type of "a" is "int&"
Yes, you can start a religious argument over this issue. I don't care. I'm right.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Michael Dunn wrote:
Ericahist
Excellent! I've finally been able to increase my "Pictures of Erica" collection from a measy two to....six. w00t! I suppose six is better than nothing though!
Thanks!
(been an Erica fan since back the GoogleFight of Erica (yeah!) vs Britney (boo! hiss!)) <insert link to the aforementioned post>
I prefer to wear gloves when using it, but that's merely a matter of personal hygiene
[Roger Wright on VB]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
[Rich Cook]
|
|
|
|
|
I am working on a program where I keep background textures in a separate DLL (for simple upgrade possibilities).
I use LoadBitmap in the DLL and I export the pointer to the asociated CBitmap to the application.
Everything works fine, except that refresh is quite slow now.
Does anyone know/recognize this behaviour , or did I do something else wrong?
If someone has a clue and solution, please let me know.
Bert....
|
|
|
|
|
you can load resource in the application directly instead of loading in
dlls.
when you load resource in the application after load some dlls.the system will
look for the resource not only in the application but also in dlls it has loaded.
i hope it works well...
gucy
|
|
|
|
|
WEll, I have been using Borland C++ Builder most of my life, and it always made GUI design a breeze.
But, now I'm using VC++; I've used it before when writing, say, DLLs, so it hasnt been a problem; however, now that I'm designing a GUI, its causing me lots of headaches.
For instance, I only now just found that the filetypes that it looks for when doing, say, file->open, is in resource string table. Or rather, thats what it lists for captions at least, not necessarily where its actually using for the filter.
So, I went and changed the caption - and, of course, its just the caption, and not the filter. So, I've been digging to see where the wizard that created my project is actually saving the filter for file-opening, as I want to add more filetypes to its initial filter.
Meanwhile, I'm also curious, if I wanted to do so, I do I add menus and toolbars to children of the parent window in a MDI project?
As I've been a developer using Borland, I've gotten spoiled with GUI Development
James A Beggs
American Quarter Horse Association Manager of Product Development
|
|
|
|
|