|
I can not able to configure out how to make TimerQueueTimer work. Any exmaple. Thanks.
|
|
|
|
|
|
i don't want to method of retsrting service but i know the method of restrating machine.
you set WM_TIMER message of 5 min
eg
SetTimer(1,1000*300,NULL);//setimer for 5 min
and now make variable that increment after every WM_TIMER message
nCount++;//like this way
when timer equal to 35
use this code for restart
HANDLE hToken; // handle to process token
TOKEN_PRIVILEGES tkp; // pointer to token structure
OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken) ;
// Get the LUID for shutdown privilege.
LookupPrivilegeValue(NULL,SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Get shutdown privilege for this process.
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES) NULL, 0);
use
::InitiateSystemShutdown(NULL,ReturnStr,(DWORD)(atoi(this->m_nmpShutdown.Time)),TRUE,TRUE); this api's
thanks
I Think It will Work
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
check my application, about the simple windos utility. There I have designed a shutdown timer. you can configure it because you have the source code
http://www.codeproject.com/useritems/A_little_window_Utility.asp
gabby
|
|
|
|
|
Is 115,200 Baud the max rate for Win32 serial driver? There are definitions for 128kbaud and 256 kbaud but these don't seem to work. If they did they would not work with the device i'm communicating with.
Thanks
Carter
|
|
|
|
|
They won't unless you have special hardware that supports them.
The highest standard baudrate is 115,200 baud and then that is divided to get 57,600 (/2), 38,400 (/3) etc.
It is possible they were put in place to support IDSN or something similar and never removed.
Elaine
The tigress is here
|
|
|
|
|
Thanks Elaine!
I think the ISDN (or whatever) support makes sense. I appreciate the help.
Carter
|
|
|
|
|
Hi, I have coded a custom CMiniDockFrameWnd derived class that removes the WS_CAPTION bit from its style to remove the title bar from the toolbar in the app.
Only trouble is that that CDockContext class calls a static function in CMiniFrameWnd to calculate the drag rect of the bar. The function is defined as;
<br />
static void PASCAL CalcBorders(LPRECT lpClientRect,<br />
DWORD dwStyle = WS_THICKFRAME | WS_CAPTION, DWORD dwExStyle = 0);<br />
<br />
void PASCAL CMiniFrameWnd::CalcBorders(<br />
LPRECT lpClientRect, DWORD dwStyle, DWORD dwExStyle)<br />
{<br />
UNUSED_ALWAYS(dwExStyle);<br />
<br />
AdjustWindowRectEx(lpClientRect, dwStyle, FALSE, WS_EX_PALETTEWINDOW);<br />
}<br />
Believe it or not, the CDockContext class uses the default parameters of the function so the drag rect of a tool bar is always calculated with a title bar and thickframe. This causes series bugs in my app not just a mis-aligned toolbar drag rect but the entire toolbar dragging screws up.
I was wondering if anyone knew a way to modify how CalcBorders behaives or how to modify the CDockContext::startDrag function without vast amounts of rewriting of MFC.
Ed Deighton - eddeighton@freeuk.com
|
|
|
|
|
|
hello guys,
i'm doing programming in vc++ on building a simple neural network. Can anyone help me out by giving any reference of coding a neural network in VC++.
thanks in advance,
Pavan.
|
|
|
|
|
GOOGLE: VC++ "neural network"
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
thanks for your suggestion....
i have tried for it many times before...but i'm not able to find anthing
|
|
|
|
|
pavanbabut wrote:
but i'm not able to find anthing
1) Start your Internet Browser Program
2) Navigate to http://www.google.com
3) Enter the Search Text:
VC++ "neural network"
4) Click the Search button
5) Wait until the search completes and displays the first page of the 737 results found
6) Click one of the links presented as results and read the contents therein
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
hello guys,
I am doin progamming in MFC for building a multi document interface. In that I am havin a openGL program which displays a bmp image. Can anyone help me how I can add that program to my MFC program in which I have defined a button for running the above bmp display program.
If anyone having problems in understanding plz let me know i'll try to clarify them.
thanks in advance,
pavan.
|
|
|
|
|
You want to spawn the OpenGL application, correct? One solution is CreateProcess().
Kuphryn
|
|
|
|
|
I am very thankful for your suggestion. The first and foremost thing that I have to do is to open a bmp image when I use the open option on my interface in a seperate document (I mean window), but I am not getting how to write a process for any menu item (and where to define that process in my MFC program) that I create on the interface and I am also having 'save' and 'save as' options and I think I have to define processes for them also....but I don't know how to define them. But i have gone through 'CBitmap' functions but I am not getting how to define them in my MFC program so that I can display any bmp image when I use my open option on my interface.
|
|
|
|
|
I have a program which pops a window on an event, an incoming phone call. This bit of code works.
HWND temphwnd;
temphwnd = FindWindow(NULL,ProgramTitle);
ShowWindow(temphwnd,SW_RESTORE);
and I can minimize it when the call drops by.
ShowWindow(temphwnd,SW_MINIMIZE);
Can anyone tell me how I can find out the current state of my program window so that I can leave it in the same state as when the call came in. If the user has the window up and active I dont want to minimize it when the call drops.
Graham
|
|
|
|
|
|
OK Thanks for that so far
That gives me the Maximized/Minimized state in that it returns
SW_NORMAL if the window is maximized and SW_SHOWMINIMIZED if minimized. The next problem is, if the window is Maximized but behind another window how can I tell that and what call do I need to bring it to the front and make it active.
If I call ShowWindow(temphwnd,SW_RESTORE); that has no effect if the window is already Maximized but not active. The write up for SW_RESTORE says "Activates and displays the window" but this does not appear to work.
Graham
|
|
|
|
|
You may want to follow the ShowWindow() with a BringWindowToTop() .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
|
I have written a simple, no frills managed C++ DLL, and am having trouble referencing it in a seperate C# project. Specifically, the C# compiler gives me an error, asking whether I have neglected to add a reference or using statement pointing to my library/namespace. However, I cannot insert a using statement in my C# code, even after properly referencing it in my project (right-click on the References icon in the Solution Explorer, click on Add Reference...).
ILDASM can traverse the C++ library, and in it I find my method (I have just one), so I suspect there is nothing wrong in the manner it compiled.
Also, the DLL I'm wanting to reference is in the same directory (bin/) as my C# project's DLL.
Is there anything special I have to account for when writing managed C++, and want to include it in a project of a different language?
~ Dr. Shim
|
|
|
|
|
I'm getting an error when I try to inherit a new view class for a MDI application, and I can't figure out why :/ .. First I created an OpenGL viewport inherited from CView, and packed it with all kinds of functionality. It works great. But now I'm trying to derive a new view class from it, and I'm getting the following error (using VC++ 6.0 professional):
C:\DEVELOPMENT\MotionX\MotionX.cpp(119) : error C2039: 'classCMotionXModelView' : is not a member of 'CMotionXModelView' c:\development\motionx\motionxmodelview.h(15) : see declaration of 'CMotionXModelView'
C:\DEVELOPMENT\MotionX\MotionX.cpp(119) : error C2065: 'classCMotionXModelView' : undeclared identifier
The thing is, I'm just deriving it from a class that is fully functional, and haven't added anything except a member variable to it.
This is the view class declaration that works:
<br />
#if !defined(AFX_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_)<br />
#define AFX_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
<br />
#include "gl/gl.h"<br />
#include "gl/glu.h"<br />
#include "gl/glaux.h"<br />
<br />
#include "MotionXSceneDoc.h"<br />
#include "MotionXCamera.h"<br />
#include "MotionXModel.h"
<br />
<br />
<br />
#define PERSPECTIVE 0<br />
#define FRONT 1<br />
#define BACK 2<br />
#define LEFT 3<br />
#define RIGHT 4<br />
#define TOP 5<br />
#define BOTTOM 6<br />
<br />
class CMotionXGLView : public CView<br />
{<br />
protected:<br />
CMotionXGLView();
DECLARE_DYNCREATE(CMotionXGLView)<br />
<br />
public:<br />
<br />
public:<br />
CMotionXModel model;<br />
void DrawGrid();<br />
<br />
void SwitchViewportMode(unsigned int);<br />
void DollyViewport(const float speed);<br />
void PitchAroundPoint(const float speed);<br />
void RotateAroundPoint(const float speed);<br />
inline void PedistalViewport(float speed);<br />
inline void StrafeViewport(float speed);<br />
CMotionXCamera viewCam;<br />
BOOL SetupPixelFormat();<br />
<br />
public:<br />
virtual void OnInitialUpdate();<br />
protected:<br />
virtual void OnDraw(CDC* pDC);
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);<br />
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);<br />
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);<br />
<br />
protected:<br />
virtual ~CMotionXGLView();<br />
#ifdef _DEBUG<br />
virtual void AssertValid() const;<br />
virtual void Dump(CDumpContext& dc) const;<br />
#endif<br />
<br />
protected:<br />
BOOL m_bCursor;<br />
double minClip, maxClip;<br />
double orthoWidth, orthoHeight, orthoZDistance;<br />
unsigned int m_viewportMode;<br />
CPoint m_pointMessage;<br />
CDC* GetDC();<br />
unsigned int height;<br />
unsigned int width;<br />
GLdouble aspectRatio;<br />
HGLRC m_hRC;
CDC* m_pDC;
<br />
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);<br />
afx_msg void OnDestroy();<br />
afx_msg void OnSize(UINT nType, int cx, int cy);<br />
afx_msg BOOL OnEraseBkgnd(CDC* pDC);<br />
afx_msg void OnMouseMove(UINT nFlags, CPoint point);<br />
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);<br />
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);<br />
afx_msg void OnViewportColorchange();<br />
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);<br />
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);<br />
afx_msg void OnViewportScreenshot();<br />
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);<br />
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);<br />
DECLARE_MESSAGE_MAP()<br />
};<br />
<br />
<br />
<br />
#endif // !defined(AFX_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_)<br />
<br />
This is the derived class.
<br />
<br />
#if !defined(AFX_MOTIONXMODELVIEW_H__AEBACD4C_059E_4D0D_8F56_6A4EFD2C25E9__INCLUDED_)<br />
#define AFX_MOTIONXMODELVIEW_H__AEBACD4C_059E_4D0D_8F56_6A4EFD2C25E9__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
<br />
#include "MotionXGLView.h"<br />
#include "MotionXModel.h"
<br />
class CMotionXModelView : public CMotionXGLView <br />
{<br />
public:<br />
CMotionXModel model;<br />
<br />
CMotionXModelView();<br />
virtual ~CMotionXModelView();<br />
<br />
};<br />
<br />
#endif // !defined(AFX_MOTIONXMODELVIEW_H__AEBACD4C_059E_4D0D_8F56_6A4EFD2C25E9__INCLUDED_)<br />
<br />
And this is my InitInstace code in my CMotionXApp class, that should tie the new class to the new document template:
<br />
m_pSceneTemplate = new CMultiDocTemplate(IDR_MOTIONTYPE,
RUNTIME_CLASS(CMotionXSceneDoc),
RUNTIME_CLASS(CChildFrame),<br />
RUNTIME_CLASS(CMotionXGLView) );
<br />
AddDocTemplate(m_pSceneTemplate);<br />
<br />
<br />
m_pModelTemplate = new CMultiDocTemplate(IDR_MOTIONTYPE,
RUNTIME_CLASS(CMotionXModelDoc),
RUNTIME_CLASS(CChildFrame),<br />
RUNTIME_CLASS(CMotionXModelView) );
<br />
Can anyone see what the problem is ??
|
|
|
|
|
NTense wrote:
//DECLARE_DYNCREATE(CMotionXModelView);
Uncomment this in your derived class, and add IMPLEMENT_DYNCREATE(CMotionXModelView, CMotionXGLView) in your .cpp file
Ryan "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"
|
|
|
|