|
Peter Weyzen wrote:
If WM_PAINT shows up with an hDC of 0 -- does that mean anything?
It means it's working as expected. As far as I know, WM_PAINT doesn't send an hDC; both wParam an lParam in that message are unused.
Maybe you mean some other message?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Thanks for the help -- I don't know all the details anymore. My boss came in wondering why this was happening...
I didn't have an answer for him...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Hi,
I have written a program. It is doing what I expected but I am not able to detect a window within that program.
Is there any function in win32 or.... which can be used to detect that window?
Please help
Thanks
Preeti9
|
|
|
|
|
|
Thanks for replying...
Here's my code.
// TSCalibrate.cpp : Defines the entry point for the application.
#include "stdafx.h"
#include "CWin32AbsPointAPI.h"
void main ()
{
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
CTouchScreenAPI* pTouch;
HWND hCalWin;
DWORD SYNCRONIZE;
DWORD procId;
HANDLE hProcess;
DWORD dwWaitResult;
pTouch = CTouchScreenAPI::Create();
if (pTouch)
{
if (pTouch->Init())
pTouch->Recalibrate();
else
MessageBox(NULL, "Created touchscreen interface OK, but Init() failed", "Info", MB_OK);
HWND hCalWin = ::FindWindow(pszABSPOINT_WND_CLASS_NAME, NULL);
GetWindowThreadProcessId(hCalWin, &procId); // retrieves the identifier of the thread that created this window.
hProcess = OpenProcess(SYNCHRONIZE, FALSE, procId); //returns a handle to an existing process object
/* SetForegroundWindow(hCalWin);
DWORD AllowSetForegroundWindow(procId);
if (AnyPopup())
{
DisplayWindow(hCalWin);
}
//AnyPopup();
while( true )
{
if( ! IsWindow(hCalWin) )
break; // window is gone;
// Sleep( 1000); // wait a second for window to close
};*/
while (1)
{
dwWaitResult = MsgWaitForMultipleObjects(1, &hProcess, FALSE, 30*1000, QS_ALLINPUT);
if (dwWaitResult == WAIT_OBJECT_0 + 1)
{
MSG xMsg;
while (PeekMessage(&xMsg, NULL, 0, 0, PM_REMOVE))
{
if (xMsg.message == WM_QUIT)
return 1;
TranslateMessage(&xMsg);
DispatchMessage(&xMsg);
}// end of PeekMessage while loop.
}
else if (dwWaitResult == WAIT_TIMEOUT)
{
SendMessage(hCalWin, WM_CLOSE, 0, 0);
//TerminateProcess(hProcess, 0);
break;
}
else dwWaitResult == WAIT_OBJECT_0;
{
//Calibration process completed;
break;
}
}
}
else
{
MessageBox(NULL, "Unable to get pointer to Touchscreen interface", "Info", MB_OK);
}
return 0;
}
This program is running calibration of a machine.
When I run this on command window, it does the calibration and the cursor in command window moves to the next line showing that calibration is done without detection.
I want to detect that window.
Please help
THanks
Preeti9
|
|
|
|
|
Why do you have both main() and WinMain() ?
I'm still not clear as to what window you are wanting to "detect" but the first thing that jumps out at me is that the calls to FindWindow() , GetWindowThreadProcessId() , and OpenProcess() could fail. Why are their return values not being checked? Could that be a reason why the window is not being detected?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
This Program is to detect the window. I associate this program with my calibration process in a machine.Calibration Process is working but it isn't able to detect this window. That's what I am looking for.
I know I need to add few lines in this code. But don't know what to add.
I really don't have any idea how to do this.
Help
Thanks
Preeti9
|
|
|
|
|
Preeti9 wrote:
I know I need to add few lines in this code. But don't know what to add.
DO u Know the Name of the Window to DETECT?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Preeti9 wrote:
This Program is to detect the window.
What window? The window that belongs to your program, or a window that belongs to some other process? What does the "calibration process in a machine" have to do with any of this? Is that related to this mysterious window somehow?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I am using a child frame window to display a view. The child frame window can be resized and when the frame is made smaller than the view scroll bars are appearing and ruining the effect that I want to achieve. The view was created in the resource editor and is of type CFormView. The frame is of type CMDIChildWnd. I have tried a bunch of the following combinations and this is where I am at...
ModifyStyle(WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU | WS_THICKFRAME | WS_CAPTION | WS_BORDER | WS_HSCROLL, 0, SWP_NOMOVE);
ModifyStyleEx(WS_EX_STATICEDGE | WS_EX_RIGHTSCROLLBAR, 0, SWP_NOMOVE);
Doesn't work
Any insight???
|
|
|
|
|
raybert wrote:
when the frame is made smaller than the view scroll bars are appearing and ruining the effect that I want to achieve.
What is that effect? You might handle WM_SIZE messages in your view and call SetScrollSizes from the corresponding OnSize function. But what to do exactly might depend on what you are trying to achieve.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Thank you for your response. I am actually asking this question for a co-worker so I needed to find out what effect he wanted. Basically, it is whenever the child window is resized to a smaller size he does not want the vertical or horizontal scrollbars to appear. I hope that makes some sense.
|
|
|
|
|
raybert wrote:
I am actually asking this question for a co-worker
raybert wrote:
it is whenever the child window is resized to a smaller size he does not want the vertical or horizontal scrollbars to appear
raybert wrote:
I hope that makes some sense.
Not much more than the original question, but never mind. If your co-worker is interested, tell him/her to post him/herself to the forum, an explain a bit more.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
D3DXCreateTextureFromFile(g_pD3DDevice,"Texture.bmp",&g_pTexture);
如果要把讀.bmp改成讀CBitmap的話,要如何改?
How to I change that input .bmp replace as input CBitmap For CreateTexture?
Becuse I want to use my file format.
|
|
|
|
|
I have an mfc ActiveX control. It exports a few functions and uses an COleControl for its main window. Basically on this machine I have running win2K it crashes when closing down.
The crash occurs in AfxWinProc due to the module state returning a null CWnd pointer given the hwnd - the message is WM_DESTROY. Somehow MFC has gone and dumped all its hWnd to CWnd* maps and the call to AfxWinProc causes the whole thing to just crash.
Unbelievably MFC doesnt simply test for a null CWnd pointer, it insists on just ASSERTing it like mad and trying to carry on regardless.
|
|
|
|
|
I have a dialog based application very simple (visual c++ .net). i added a windows media player control to the dialog resource. next i gave an id IDC_PLAYER. next i added a variable called m_ctrlPlayer(Add Variable). I have also a button (play) and below is the event handler for that button.
void CWindowMediaDlg::OnBnClickedPlay()
{
// TODO: Add your control notification handler code here
m_ctrlPlayer.GetControls().play();
}
i get this error when i try to compile the project....
error C2039: 'GetControls' : is not a member of 'COcx1'
ocx1.h(11) : see declaration of 'COcx1'
error C2228: left of '.play' must have class/struct/union type
and here is how COcx1 looks...
#pragma once
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten.
/////////////////////////////////////////////////////////////////////////////
// COcx1 wrapper class
class COcx1 : public CWnd
{
protected:
DECLARE_DYNCREATE(COcx1)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x6BF52A52, 0x394A, 0x11D3, { 0xB1, 0x53, 0x0, 0xC0, 0x4F, 0x79, 0xFA, 0xA6 } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID);
}
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey);
}
// Attributes
public:
enum
{
amvUninitialized = 0,
amvLoading = 1,
amvInteractive = 3,
amvComplete = 4
}ReadyStateConstants;
enum
{
mpStopped = 0,
mpPaused = 1,
mpPlaying = 2,
mpWaiting = 3,
mpScanForward = 4,
mpScanReverse = 5,
mpClosed = 6
}MPPlayStateConstants;
enum
{
mpDefaultSize = 0,
mpHalfSize = 1,
mpDoubleSize = 2,
mpFullScreen = 3,
mpFitToSize = 4,
mpOneSixteenthScreen = 5,
mpOneFourthScreen = 6,
mpOneHalfScreen = 7
}MPDisplaySizeConstants;
enum
{
mpReadyStateUninitialized = 0,
mpReadyStateLoading = 1,
mpReadyStateInteractive = 3,
mpReadyStateComplete = 4
}MPReadyStateConstants;
enum
{
mpTime = 0,
mpFrames = 1
}MPDisplayModeConstants;
enum
{
mpShowURL = 0,
mpClipURL = 1,
mpBannerURL = 2
}MPMoreInfoType;
enum
{
mpShowFilename = 0,
mpShowTitle = 1,
mpShowAuthor = 2,
mpShowCopyright = 3,
mpShowRating = 4,
mpShowDescription = 5,
mpShowLogoIcon = 6,
mpClipFilename = 7,
mpClipTitle = 8,
mpClipAuthor = 9,
mpClipCopyright = 10,
mpClipRating = 11,
mpClipDescription = 12,
mpClipLogoIcon = 13,
mpBannerImage = 14,
mpBannerMoreInfo = 15,
mpWatermark = 16
}MPMediaInfoType;
enum
{
dvdMenu_Title = 2,
dvdMenu_Root = 3,
dvdMenu_Subpicture = 4,
dvdMenu_Audio = 5,
dvdMenu_Angle = 6,
dvdMenu_Chapter = 7
}DVDMenuIDConstants;
enum
{
mpShowDialogHelp = 0,
mpShowDialogStatistics = 1,
mpShowDialogOptions = 2,
mpShowDialogContextMenu = 3
}MPShowDialogConstants;
// Operations
public:
};
someone pleaze tell me how i fix this problem. thax
thanx hussein
|
|
|
|
|
Add int the CWindowMediaDlg:
#include "wmpcontrols.h"
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
c+- wrote:
i still get errors.....
WindowMediaDlg.cpp(5) : fatal error C1083: Cannot open include file:
'wmpcontrols.h': No such file or directory ...where can i get this file...
Quite strange. How have you added Windwos Media to your project? I suppose by "Project > Add to project > Components and Controls > Registered ActiveX Controls > Windows Media Player", isn't it?
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
NO i didn't add it like that. There is no such menu item 'Add to project' under project menu. this is how i added, in resourse view right click on toolbax->Add/remove items->COM components->windows media player then the control appeared on the toolbax, then i added it to dialog.
hussein
|
|
|
|
|
I've tried on VC++6 and it works like a charm. I can't test it in a VC.Net environment so there have to be something missing.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Is there a version of StringFromCLSID for ANSI?
Don't try it, just do it!
|
|
|
|
|
Try UuidToString. I'm not sure if it encodes the values the exact same way.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
CString CGuid::ToString(bool withCurlies) const
{
#ifdef _UNICODE // ----- UNICODE -----------
LPCWSTR mask = withCurlies ? L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}" :
L"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
#else
LPCSTR mask = withCurlies ? "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}" :
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
#endif
CString s;
s.Format(mask,
Data1, Data2, Data3, Data4[0], Data4[1],
Data4[2], Data4[3], Data4[4], Data4[5],Data4[6], Data4[7]);
return s;
}
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
Hi, all:
I am trying to create some cursors with bigger than 32x32x256 color. Here is what I did:
I created a simple Dialog Based MFC appication and place a simple button (IDC_BUTTON1) on the dialog.
I created a 96X96x256 color cursor in the Resource Editor: IDC_CURSOR1 ( Deleted the 32x32XMono) .
In the Button1 click event handler, I have the following code:
<br />
void CCursorTestDlg::OnButton1() <br />
{<br />
::SetCursor(::LoadCursor( AfxGetInstanceHandle(),MAKEINTRESOURCE(IDC_CURSOR1) ));<br />
<br />
}<br />
I also handle the WM_SETCURSOR event as
<br />
BOOL CCursorTestDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) <br />
{<br />
<br />
return TRUE;<br />
<br />
}<br />
After I clicked on the Button1, the cursor changed to the IDC_CURSOR1, but shrinked it to 32x32 size.
What do I do wrong, how can I keep it to my size in the Resource Editor?
Thanks in advance and your help is highly appreciated.
Dion
|
|
|
|
|
Have you tried using LoadImage() instead of LoadCursor()? IIRC LoadCursor only loads cursors of the default size for the system.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|