|
I'm assuming your talking about an NT-based machine? Use the command line...
C:\>net stop dhcp
C:\>net start dhcp
You can do this behind-the-scenes from a program. Just remember you won't get control back until the statement finishes executing (in the same thread that is). If you are looking for something different, please give more details.
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
|
|
|
|
|
At a Command Prompt, enter the following:
ipconfig /release_all
ipconfig /renew_all
Josh Knox
that-guy.net
"Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown
|
|
|
|
|
Should work on Win98, ME, 2000 and XP
/Ola
|
|
|
|
|
I have recently started learning some more computer graphics (mostly 2D) for my hobby projects. My question is if I should dig deeper into DirectX or OpenGL? DirectX has better performance (on MS platforms), but is more complex. OpenGL has the advantage of better portability, but lack some of the bells and whistles of DirectX. Are these observations correct, and which do you suggest for learning?
Any suggestions would be appreciated.
Thanks
/moliate
|
|
|
|
|
This article at GameDev is about this exact topic.
My personal view is that OpenGL is not lacking in performance or capabilities (refer to Quake3) and is a bit simpler to use but I have not done any significant programming with DX. Given the large volume of samples and tutorials on OpenGL I think it would probably be better to learn with initially.
|
|
|
|
|
Thanks for the article! Must admit that the bulk of code required to write even the simplest DirectX app was getting me down, but I thought it was the way to do it on MS platforms.
I'll take a furter look at OpenGL...
/moliate
|
|
|
|
|
Hi All,
I am wondering how to get the actual COM interface (let's say ISpeedometer) of an ActiveX control on a dialog in MFC. In ATL, you can do this pretty easily with GetDialogControl, which will give you a pointer to IUknown of the control, which can be queried for the more derived interface of interest. I assume there must be a way to do something like this in MFC. I am trying to get arond the generic wrapper class generated by class wizard which just gets to all of a control's functionality through its IDispatch interface.
Thanks,
Aaron
|
|
|
|
|
So you have IDispatch? Why don't you QueryInterface for ISpeedometer?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
No, I don't have any interfaces. Just the ID of the control on the dialog resource. So I need to get an interface, any interface.
I figured out how to do this using CWnd::GetControlUnknown, which gave me IUnknown for the ActiveX control, from which I can query for more specific interfaces.
Thanks,
Aaron
|
|
|
|
|
I recently ported an old VC++ program from 6.0 to .NET. There were a few issues to begin with, but the only thing that I've changed in the product is that I'm using the Shared DLL option to reference MFC now instead of Static Library. The program builds fine and runs, but when I perform pointer intensive operations the performance in .NET is horrible. We're talking an order of magnitude here. Execution that takes 2 seconds in 6.0 takes 30 seconds in .NET. I've tried all the optimizations I can think of but none of them did anything to increase performance. Should I just stick to 6.0 for now? Why is it so slow? It's unmanaged code so I don't think GC would be affecting performance at all. It seems like it is though. What's the deal? Any input is appreciated.
myenigmaself
http://myenigmaself.gaiden.com
myenigmaself@yahoo.com
"If debugging is the process of removing bugs from code, programming must be the process of putting them in."~~Dykstra
|
|
|
|
|
What you say is very surprising, to say the least. Could you isolate some snippet of code showing this behavior? Also, although I don't think is having any effect, it'd be useful to perform the testing on as similar scenarios as possible --that implies having the same linkage method for MFC.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The code would be a little ambiguous taken out of context so let me see if I can figure out a smaller example or see if there is something I can do about this.
And could the fact that I have VC++6.0 still installed be messing things up? I think the MFC Versions are getting crossed up. I can no longer used a Shared DLL in my VC++ 6.0 projects.
"If debugging is the process of removing bugs from code, programming must be the process of putting them in."~~Dykstra
|
|
|
|
|
Forget this. No matter what I do I can't get my old code to use a static library in vc7. Here's the kicker, my code HAS to use a static library in vc6. For some reason I can no longer use the linked dll in vc6. This is messed up. I'm going home.
"If debugging is the process of removing bugs from code, programming must be the process of putting them in."~~Dykstra
|
|
|
|
|
|
Debug build?
Have you disabled the new /GS option?
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Yes, I tried it with the Buffer Security Check turned off but that didn't effect performance at all.
"If debugging is the process of removing bugs from code, programming must be the process of putting them in."~~Dykstra
|
|
|
|
|
Hi, gurus,
I created a worker thread in CMyView using
AfxBeginThread(MyThread, GetSafeHwnd());
and my worker thread is declared as:
UINT MyThread(LPVOID pParam);
If I want to use a data member (m_nData) of CMyView in MyThread(), how I can get it using (HWND)pParam?
Any hint is highly appreciated!
|
|
|
|
|
Can you afford passing the address of the CMyView object itself to the thread, rather than the HWND ? I.e. why not call AfxBeginThread(MyThread, this) , which gives you access to the whole object, its m_nData member and its HWND (through m_hWnd member.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Got it. Done. Thank you so much!
(I feel so stupid sticking to GetSafeHwnd)
|
|
|
|
|
Hi !
I´m currently coding an application that displays graphically mathematical curves (with a CDC). I´d like to implement a zoom on it, that is: the user clicks, and when he moves the mouse while holding the mouse button down, the prg draws a rectangle with dot lines. When the user stops maintaining the mouse button down, it zooms-in. (The whole thing acts like selecting two or more icons on the desktop of windows, for example).
Well, i actually want to know an easy way to draw the rectangle with dot lines ... because I suppose it must be another way than saving the background, drawing the rectangle, and - when the user moves - redisplaying the saved background and redrawing the rectangle, must´nt it?
RaGe
Unfortunately, brute-force solutions tend to be slow
even when performed by modern-day microcomputers,
which are capable of several MIPS except when I'm late
for an appointment and want to finish a compile and
run just one more test before I leave, in which case
the crystal in my computer is apparently designed to
automatically revert to 1 Hz.
-- Michael Abrash
|
|
|
|
|
Try DrawFocusRect. It works in XOR mode - drawing it twice removes it from the screen.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
An alternative to Tomasz' suggestion is using <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_crecttracker.asp">CRectTracker</a> .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I am very close to losing my sanity trying to build some code with visual c++. I am sure the problem will have a very simple solution but i could do with some help none the less.
I have a program with six source code files and six associated header files, they all compile fine but when trying to link i get the following error.
test.obj : error LNK2001: unresolved external symbol "void __cdecl mht_associate(struct tracker_struct * *,struct measurements_struct * *,struct parameter_struct *,int,double * * *,int,int,int,int)" (?mht_associate@@YAXPAPAUtracker_struct@@PAPAUmeas
urements_struct@@PAUparameter_struct@@HPAPAPANHHHH@Z)
Debug/mht.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
The funcion being called in a file test.c and is defined in a file mhtwrapper.h, the code is contained in mhtwrapper.c.I have checked for all the simple mistakes that i can think of, such a spelling errors and i have tried declaring the function as external with no joy. When i run dumpbin on the mhtwrapper.obj file the function symbol does seem to be defined.
Symbol index: 10 Base line number: 14
Symbol name = _mht_associate
0000001B( 15) 00000022( 16) 00000029( 17) 00000030( 20)
00000037( 22) 0000003E( 23) 00000058( 25) 00000072( 27)
00000091( 28) 00000093( 29) 00000095( 30) 000000A6( 32)
000000B5( 34) 000000C4( 35) 000000D5( 37) 000000E8( 38)
000000FB( 39) 0000010E( 41) 0000012A( 43) 00000146( 45)
00000175( 46) 000001A4( 47) 000001D3( 48) 000001D8( 49)
000001DD( 50) 000001ED( 51) 000001FF( 52) 00000211( 53)
0000021D( 54) 00000229( 55) 00000235( 58) 0000023C( 59)
0000025A( 61) 00000278( 63) 00000297( 64) 000002CB( 67)
000002DB( 69) 000002F3( 70) 0000030D( 73) 00000316( 74)
00000326( 76) 00000342( 78) 00000387( 79) 0000039F( 81)
000003EE( 82) 000003F0( 83) 000003F5( 84) 000003FA( 85)
000003FF( 86) 00000404( 87) 0000041B( 89) 00000445( 91)
0000044E( 92) 0000046C( 94) 0000047C( 95) 00000498( 98)
000004D8( 101) 00000518( 103) 00000534( 106) 0000057F( 109)
000005CA( 110) 000005CF( 111) 000005D4( 113) 000005FB( 114)
00000624( 115) 00000639( 118) 0000063E( 120) 0000064A( 123)
and
010 00000000 SECT3 notype () External | _mht_associate
tag index 0000001A size 0000066E lines 00000DA8 next function 00000000
Any advice would be gratly appriciated.
Thanks
Scott Sims
|
|
|
|
|
Well, I had a similar problem the other day when compiling some c code with the settings (calling convention) set for __cdecl when it should have been __stdcall...
(Don't laugh folks - someday one of these pitifully lame suggestions will actually help someone, and _then_ I'll be cool... )
|
|
|
|
|
Thanks but i have allready tried and it has no effect
Scott Sims
|
|
|
|