|
|
SetCursor itself only works for a while.
You need to do two things: Set the window class cursor to NULL, and handle the WM_SETCURSOR message
to NULL.
So...
char __myclass [] = "Midas3View";
BOOL CMyView::PreCreateWindow( CREATESTRUCT& cs )
{
WNDCLASS wc;
wc.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = ::DefWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = cs.hInstance;
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground= NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName= __myclass;
AfxRegisterClass (&wc);
cs.lpszClass = __myclass;
return TRUE;
}
...to remove the default cursor. And...
...
ON_WM_SETCURSOR()
...
BOOL CMyView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (nHitTest != HTCLIENT)
return CView::OnSetCursor(pWnd, nHitTest, message);
if (m_bNote1)
SetCursor (cursor used with Note 1);
else
SetCursor (other cursor...);
return TRUE;
}
To set the cursor on the fly.
You can probably search OnSetCursor in MSDN for all this information.
Good luck,
Iain.
|
|
|
|
|
Hi!
I am trying to make a windows service with Visual Studio .net 2003. But something is really wrong!
I start a Visual C++ Project and choose WIndows Service (.NET). If I try to build it, without tuching the code I get error.
First I get a message box with this info:" CLR error: 8007000b. The program will now terminate."
When I press OK, I get this in my output:"projectname : error PRJ0003 : Error spawning 'resgen.exe'"
All the code is generated from Visual Studio .NET, and I dont know whats wrong. If I try the same with VB everything work.
Hope someone can help me.
Andreas
|
|
|
|
|
I have generated Windows Services using the same wizard option without such problems.
It sounds as though the installation is corrupt or the running instance of .NET is corrupt in some way.
If you have tried compiling after a clean reboot and you still get the error then you could try:
1) Installing the SP for .NET again
2) Reinstalling .NET
Ant.
|
|
|
|
|
Or you can use the Win32 CreateService(...) function to create a service. Search MSDN for CreateService and there is also an example of the code at the end of the document. Hope this helps.
-Tareq
|
|
|
|
|
I've always thought that the concept of a Wizard-generated service was a scary one. The Wizards are, IMO, only valuable if you already understand what they're doing.
The error code is Win32 error 11 (0x8007xxxx is a Win32 HRESULT, so we just interpret the last four characters as 0xb == 11) which means "An attempt was made to load a program with an incorrect format" (according to Error Lookup).
I think this probably means resgen.exe , the managed resource generator, is corrupted, or possibly that the .NET Framework is damaged or missing. Either way a reinstall/repair is safest.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I am trying to use the MapPoint control in a C++ .Net 2003 program. There is a SelectionChanged event which has a pointer to the selected object. But when I try to find out what type of object was selected with the GetType function, all I get is System._ComObject. Most of the MapPoint examples use Visual Basic and the Typeof operator. How do I figure out what type of object is selected in C++?
Mike Huslig
|
|
|
|
|
I want to close notepad if it is open and I don't know how to do it.
|
|
|
|
|
Check FindWindow and SendMessage (and WM_CLOSE)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
you can close program by two method
1. by sending WM_CLOSE, you have to find the window using FindWindow function.
2. using TerminateProcess(hProcess, 0), you need to find the process id (pid)
I find the other method better, if the application have many threads, for example when you exit the visual studio, its running many threads in background. Its hide the window but takes time to clear all the threads. you can see it from task manager.
// Shail [11/11/2002]
const CString ConfigPage::ProcessTerminate(int nApp, bool &bSuccess) const
{
CString msg;
DWORD pid = 0;
HANDLE hProcess;
CCSITimer oTimer;
bSuccess = true;
SetCursor(LoadCursor(NULL, IDC_WAIT));
pid = GetPIDfromAppName(m_strProcessApps[nApp]);
if (pid)
{
// open the process with all access
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
// bye-bye
if (hProcess)
{
TerminateProcess(hProcess, 0);
oTimer.Start();
while ( ( pid )
&& !oTimer.IsElapsed( PROCESS_TERMINATE_TIMEOUT ) )
{
Pump();
oTimer.Delay(500);
pid = GetPIDfromAppName(m_strProcessApps[nApp]);
}
if ( pid == 0 )
msg.Format("%s Terminated.", m_strApps[nApp]);
else
bSuccess = false;
}
}
return msg;
}
const CString ConfigPage::ProcessDistroy(int nApp, bool &bSuccess) const
{
CString msg;
CWnd * pWnd = NULL;
CCSITimer oTimer;
SetCursor(LoadCursor(NULL, IDC_WAIT));
if (m_strApps[nApp].IsEmpty())
return msg;
pWnd = FindWindow(NULL, m_strApps[nApp]);
if (pWnd )
{
pWnd->PostMessage(WM_CLOSE);
if ( C7StartupConfigPage::nDS == nApp )
{
msg.Format("Close %s Manually.", m_strApps[nApp]);
}
else
{
oTimer.Start();
while ( (NULL != pWnd)
&& !oTimer.IsElapsed( PROCESS_TERMINATE_TIMEOUT ) )
{
Pump();
oTimer.Delay(500);
pWnd = FindWindow(NULL, m_strApps[nApp]);
}
if ( NULL == pWnd )
msg.Format("%s Terminated.", m_strApps[nApp]);
else
bSuccess = false;
}
}
else
{
// Shail [11/11/2002]
// if app window doesn't exists, then just terminate the app. [ most prob. its a crashed app.]
ProcessTerminate(nApp, bSuccess);
}
return msg;
}
Shail Srivastav
shailsrivastav@hotmail.com
|
|
|
|
|
Hi,
Background:
A GUI (VB DLL) is running off an application, which has some button on it. And VC++ DLL is also referenced in the same application and same thread.
Question:
What I want to do is when I press the button on GUI, the VC++ project should be able to catch that particular event. Basically making VC++ a client of the GUI (VB project) somehow, I guess.
Someone advised me to use IConnectionPoint interface, which can help to catch this particular "button click" event. But after reading from MSDN, I was not sure how this could help.
Anybody who has used IConnectionPoint interface before and can help me out with this problem.
Any help is appreciated.
|
|
|
|
|
Hi, I'm porting a macintosh application to windows. And I was wondering if there is an winapi/MFC alternative for the function WaitMouseMoved (http://developer.apple.com/documentation/Carbon/Reference/Drag_Manager/drag_manager/function_group_13.html#//apple_ref/c/func/WaitMouseMoved)
Thanks
|
|
|
|
|
|
Not exactly the same. But I've found what I was looking for: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/MouseInput/MouseInputReference/MouseInputFunctions/DragDetect.asp
Thanks anyway!
|
|
|
|
|
First. I get weird random errors when I miss a semi colon off the end of a class definition. Each time I do a compile with it missing it seems to bring up a different error each time I hit build. In one case about an .sbr file missing. Generally though it thinks there are errors with other header files, but not that fact that you have missed the semi colon off the end of the definition.
Second thing. In the MSDN documentation for an stl::queue, according to the MSDN docs its says that for the .back and .front methods both say
Return Value : The last element of the queue. .
A bit of copy and pasting probably. Anyway, just wanted to let you know. I'm fairly sure VC6, gave odd errors, but that they were always the same, about end of file reached before end of class definition or something.
Anyone want to confirm the the front is the next item to be popped?
|
|
|
|
|
Giles wrote:
Anyway, just wanted to let you know
Send an e-mail to msdn@microsoft.com.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
hi,
i seeking for some APIs that'll give some information about the current powers source. And for the case the system is running on batteries give the total battery power remaining as shown in the application PowerMeter !
Thanks in advance and best regards
Dick
|
|
|
|
|
GetSystemPowerStatus(...)
|
|
|
|
|
Does anyone here have example code that show how to send a WM_VSCROLL message to a CListCtrl control using SB_THUMBPOSITION, SB_THUMBTRACK, and SB_ENDSCROLL to scroll a listctrl?
I have watched spy++ and can clearly see that these are the messages that are being sent to the CListCtrl when dragging the thumb control of CListCtrl's scrollbar, but I can't get the list to scroll by doing SendMessage commands to the CListCtrl. Can anyone post sample code on how to do this properly if it is possible?
Thanks,
Greg
|
|
|
|
|
What about Scroll( CSize size )?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I have tried that, but it does not work exactly the same as the WM_VSCROLL message. The blting that it does is very poor. If I was able to somehow send the WM_VSCROLL message it would solve all my problems.
Cheers,
Greg
|
|
|
|
|
I try to add my voice recorder ActiveX control to a my company's mail posting page , but got in trouble: how to add just recorded wave file to mail server as an attachment?
thanks for any help!
|
|
|
|
|
Hi.
Why sometime the intellisense feature disappear?.
I'm writing an aplication, and suddenly I don't have any more the intellisense feature, (for example the list of methods and fields of an object, etc).
I have Visual 6.0 Enterprice edition.
Should I install some patch or something like this.
Thank you.
|
|
|
|
|
Roger H. Art wrote:
Why sometime the intellisense feature disappear?.
It just does (no matter what patch has been applied). In the project's folder, delete the .ncb file. Open the project again and that file will get recreated.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes that work's!.
Thank you very much David I really appreciate your help.
|
|
|
|