|
FlashWindowEx is declared in WinUser.h. If you open WinUser.h and do a text search for FlashWindowEx you will see that FlashWindowEx is wrapped in a pre-processor conditional statement "#if(WINVER >= 0x0500)". So to use FlashWindowEx you have to #define WINVER 0x0500 at the top of your stdafx.h file.
"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!
|
|
|
|
|
the problem is I don't have FlashWindowEx in the WinUser.h
here is what I have
FlashWindow(<br />
HWND hWnd,<br />
#if(WINVER >= 0x0500)<br />
DWORD dwFlags);<br />
#else<br />
BOOL bInvert);<br />
#endif<br />
<br />
#if(WINVER >= 0x0500)<br />
#define FLASHW_STOP 0<br />
#define FLASHW_CAPTION 0x00000001<br />
#define FLASHW_TRAY 0x00000002<br />
#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY)<br />
#define FLASHW_TIMER 0x00000004<br />
#define FLASHW_TIMERNOFG 0x0000000C<br />
#endif /* WINVER >= 0x0500 */
any help with it? thanks....
|
|
|
|
|
You've probobly still got a REALLY old version of the platform SDK, you've got two options, either download[^] the latest version or access the FlashWindowEx function on the fly using GetProcAddress[^].
If you choose the later option, you'll need something like:
typedef struct {
UINT cbSize;
HWND hwnd;
DWORD dwFlags;
UINT uCount;
DWORD dwTimeout;
} FLASHEXINFO, *PFLASHEXINFO;
#define FLASHW_STOP 0
#define FLASHW_CAPTION 0x00000001
#define FLASHW_TRAY 0x00000002
#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY)
#define FLASHW_TIMER 0x00000004
#define FLASHW_TIMERNOFG 0x0000000C
typedef BOOL (WINAPI *PSFLEX)(PFLASHEXINFO);
static PSFLEX pFlashWindowEx = NULL;
static BOOL initFlash = FALSE;
BOOL uiFlashWindowEx( HWND hWnd, UINT uCount , DWORD dwFlags )
{
if ( ! initFlash )
{
HMODULE hDLL = NULL;
hDLL = LoadLibrary( TEXT( "user32.dll" ) );
if( hDLL )
{
pFlashWindowEx = ( PSFLEX ) GetProcAddress( hDLL, "FlashWindowEx" );
initFlash = TRUE;
}
}
if ( pFlashWindowEx == NULL )
return FALSE;
FLASHEXINFO fwi;
ZeroMemory( & fwi, sizeof( FLASHEXINFO ) );
fwi.cbSize = sizeof( FLASHEXINFO );
fwi.dwFlags = dwFlags;
fwi.hwnd = hWnd;
fwi.uCount = uCount;
fwi.dwTimeout = 0L;
return pFlashWindowEx ( & fwi );
}
Once done, just use uiFlashWindowEx( hWnd, 3, FLASHW_TRAY ); or whatever
Gavin Taylor
w: http://www.gavspace.com
-- modified at 12:37 Tuesday 3rd January, 2006
|
|
|
|
|
thanks alot, I download the last PSDK and linked the vc++ compilter to the new dorectories, and it works great now, thanks alot...
|
|
|
|
|
Hi
I want to show a tooltip on Editbox when my mouse cursor go on it.How can I do it?
I know CTooltipCtrl but I can't use it for editbox.
Agh
-- modified at 2:24 Tuesday 3rd January, 2006
|
|
|
|
|
|
Hi,
I am receiving an error message CXX0030 when trying to a readfile off a com 1 port.
My code is
hCom = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // must be opened with exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // must use OPEN_EXISTING
0, // not overlapped I/O
NULL);
if (hCom == INVALID_HANDLE_VALUE)
{
// Handle the error.
printf ("CreateFile failed with error %d.\n", GetLastError());
return ;
}
// Build on the current configuration, and skip setting the size
// of the input and output buffers with SetupComm.
fSuccess = GetCommState(hCom, &dcb);
if (!fSuccess)
{
// Handle the error.
printf ("GetCommState failed with error %d.\n", GetLastError());
return ;
}
//printCommState();
// Fill in DCB: 57,600 bps, 8 data bits, no parity, and 1 stop bit.
init_settings();
fSuccess = SetCommState(hCom, &dcb);
//printf ("SetCommState...\n");
if (!fSuccess)
{
// Handle the error.
printf ("SetCommState failed with error %d.\n", GetLastError());
return ;
}
fSuccess = GetCommState(hCom, &dcb);
if (!fSuccess)
{
// Handle the error.
printf ("GetCommState failed with error %d.\n", GetLastError());
return ;
}
//printCommState();
//printf ("Serial port %s successfully reconfigured.\n", pcCommPort);
res = GetCommTimeouts(hCom, &get_com_time_outs);
//print_com_timeouts();
res = SetCommTimeouts(hCom, &com_time_outs);
//printf("SetCommTimeouts...\n");
if(!res) printf("SetCommTimeouts failed...\n");
res = GetCommTimeouts(hCom, &get_com_time_outs);
read_bytes=0;
char *reply;
DWORD dwBytesTransferred;
DWORD dwCommModemStatus;
// Specify a set of events to be monitored for the port.
SetCommMask (hCom, EV_RXCHAR | EV_CTS | EV_DSR | EV_RLSD | EV_RING);
while (hCom != INVALID_HANDLE_VALUE)
{
// Wait for an event to occur for the port.
// WaitCommEvent (hCom, &dwCommModemStatus, 0);
// Re-specify the set of events to be monitored for the port.
SetCommMask (hCom, EV_RXCHAR | EV_CTS | EV_DSR | EV_RING);
//if (dwCommModemStatus & EV_RXCHAR)
//{
// Loop for waiting for the data.
do
{
// Read the data from the serial port.
res = ReadFile(hCom, reply, 81, &dwBytesTransferred, 0);//ReadFile (hCom, &Byte, 1, &dwBytesTransferred, 0);
// Display the data read.
if (dwBytesTransferred > 0)
printf (reply);
} while (dwBytesTransferred == 1);
//}
}
void init_settings()
{
dcb.DCBlength = sizeof(DCB);
dcb.BaudRate = CBR_9600; // set the baud rate
dcb.fBinary = TRUE;
dcb.Parity = NOPARITY; // no parity bit
dcb.fOutxCtsFlow = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fDtrControl = DTR_CONTROL_ENABLE; //
dcb.fDsrSensitivity = FALSE;
dcb.fTXContinueOnXoff = FALSE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
dcb.ErrorChar = FALSE;
dcb.fNull = FALSE;
dcb.fRtsControl = RTS_CONTROL_ENABLE;
dcb.fAbortOnError = FALSE;
dcb.fDummy2 = 0;
dcb.wReserved = 0;
dcb.XonLim = 0;
dcb.XoffLim = 0;
dcb.ByteSize = 8;
dcb.StopBits = ONESTOPBIT; // one stop bit
dcb.XonChar = 0;
dcb.XoffChar = 0;
dcb.ErrorChar = 0;
dcb.EofChar = 0;
dcb.EvtChar = 0;
dcb.wReserved1 = 0;
}
Is there something I am missing for reading off the com port?
Thanks
|
|
|
|
|
Several problem areas here...
char *reply;
DWORD dwBytesTransferred;
DWORD dwCommModemStatus;
SetCommMask (hCom, EV_RXCHAR | EV_CTS | EV_DSR | EV_RLSD | EV_RING);
while (hCom != INVALID_HANDLE_VALUE)
{
SetCommMask (hCom, EV_RXCHAR | EV_CTS | EV_DSR | EV_RING);
do
{
res = ReadFile(hCom, reply, 81, &dwBytesTransferred, 0);
if (dwBytesTransferred > 0)
printf (reply);
} while (dwBytesTransferred == 1);
}
First, char* reply is only a pointer to a single character but you're trying to read 81 characters - you need a larger buffer. This is your real problem area.
Second, while not your problem, dwBytesTransferred is not initialized - you should always initialize your variables.
Third, while (dwBytesTransferred == 1) should be changed - if successful in this case, it will be 81. Perhaps you should say:
while (dwBytesTransferred > 0);
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
krmed wrote: char* reply is only a pointer to a single character...
A minor point here, char* reply does not point to a single character. It points to some unknown memory location, which the compiler thinks contains a character buffer.
INTP
Every thing is relative...
|
|
|
|
|
Thanks,
It actually worked when I changed it from a char pointer to a char array. But why would it work in this case if the pointer and the array could mean the same thing?
|
|
|
|
|
Using an array actually has memory allocated for the buffer, but the pointer is just a pointer - you have to allocate the memory yourself (and delete it when you are through.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Of course you are right. But then at my age I guess I'm allowed one brain fade after 11 consecutive days off!
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
The debugger’s expression evaluator could not obtain a value for the expression as written. One likely cause is that the expression refers to memory that is outside the program’s address space (dereferencing a null pointer is one example). Windows NT and Windows 95 do not allow access to memory that is outside of the program’s address space.
You may want to rewrite your expression using parentheses to control the order of evaluation
More Info ref-MSDN
regards,
Rajan
|
|
|
|
|
Hi All,
What I Need?
------------
I want to change the ToolButton's image with respect to different conditions.
What I did?
-----------
I creatd mfc application with ToolBar. And i added UI Command handler to the target ToolBar Button. In that handler i called CToolBar::SetButtonInfo() to change the button image into new one which i drawn.
What Stoped me?
--------------
After this step i saw my target ToolButton image is blinking. And also when pass the mouse pointer over ToolBar buttons, All buttons stops ToolTip popup.
What could be the possible reason to this??
Thanks n regards,
Rajan
"What Happened to a man is less signigicant than what happened inside him"
|
|
|
|
|
rajan4008 wrote: And i added UI Command handler to the target ToolBar Button. In that handler i called CToolBar::SetButtonInfo() to change the button image into new one which i drawn.
LOL What are you trying to do buddy. Why do you do this in the UI command handler. Everytime the UI is updated the Image will be reset. Hence I think the blinking.
Note: UI handlers must always try to use CCmdUI object to deal with UI updation. AFAIK you never know when it will be called. So it's safe to use the CCmdUI object. And don't try to do anything else.
You can use SetButtonInfo in the OnCreate function for the frame.
rajan4008 wrote: After this step i saw my target ToolButton image is blinking
OT: Now I know how to blink a toolbar button...He he;P
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Hi Buddy,
I wanna change image of ToolButton based on some condition. More clearly, My App has TreeView item. When user selects Target Item from the TreeView Items then i, wanna change image of my ToolButton. I have drawn 2 images-One is set as default and another one is set based on TreeView Item contents.
As you told, I already added SetButtonInfo() in Frame's OnCreate().However, if user selects something from TreeView which changes ToolButton's colour and he deselects the item then i, need to show the item as default image. Hence, I did SetButtonInfo() again in OnUpdateButtonxxxx().
For Instance:
void CMainFrame::OnUpdateButtonxxxx()
{
// Check wheather TreeView Item is Selected
theApp.ToggleButton();
}
void CMyApp::ToggleButton()
{
if(UserSelctedTreeViewItem)
SetButtonInfo(TOOLBUTTON_IND, XXXX, PUSHBUTTON, GREEN);
else
SetButtonInfo(TOOLBUTTON_IND, XXXX, PUSHBUTTON, GRAY);
}
NOTE: ToolTip is blocked due to this code. That's my major problem.
Some of My Doubts are:
1.If SetButtonInfo() is called with same ID then does it stop ToolTip? if yes how?
2.I accept that due to calling SetButtonInfo() again and again in the OnUpdateButton() Handler i'm getting blinking image. But it is not happening when i change the resource ID and also i'm getting ToolTip.
3.To achieve dynamic image toggling where should we call SetButtonInfo()?
Thanks in Advance,
Rajan
|
|
|
|
|
There are notification messages for this purpose.
Suppose you wanna handle selection change event then do this. (Write this in the parent window)
ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnNotifySelChange)
in .h file
afx_msg void OnNotifySelChange(NMHDR* pNm, LRESULT *pRes);
in .cpp file
void CYouparentClass::OnNotifySelChange(NMHDR* pNm , LRESULT *pRes)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
}
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I want to create a time delay about 1/20 milisecond.
|
|
|
|
|
You can use QueryPerformanceCounter().
|
|
|
|
|
hai do u know assmbly language.
if u know 8086 assm lan Easily you can create a time delay
|
|
|
|
|
You probably can't reliably without going to extrodinary means. This is because Windows is not a Real time operating system, and at any stage your process could be preempted. However, the closest you can get is by calling
::Sleep(20)
In reality this will sleep more than twenty milliseconds quite often, because it relinquishes your timeslice in the process scheduler, but it is the best you can do without doing something really hard.
Despite what my mis-spelling co-poster tells you, going to assembly language will not offer you any benefit over the above, because it is no less subject to pre-emption than anything else. He/she might argue that you do not relinquish your timeslice as above, however the same can be accomplished in C++ too.
For example:
class Timer
{
public:
Timer();
void wait(DWORD ms);
private:
static int cyclesPerMs; // Number of loop iterations per millisecond
};
int Timer::cyclesPerMs = -1;
Timer::Timer()
{
const CALIBRATION_TICKS = 100000;
if(cyclesPerMs == -1)
{
// Calibrate timer
clock_t start = clock();
for(int i=0; i
|
|
|
|
|
What do you need the delay for?
Don't try it, just do it!
|
|
|
|
|
Hi,
My query is MFC related to Dialog box.
I want to change the Text property label of parent dialog box from its child dialog file.
How to change Text lable of parent dialog box from its child dialog file?
Thanks in advance
-Ramesh.
|
|
|
|
|
Use GetParent() from the Child Dialog.
GetParent()->SetWindowText("New title");
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Thanks,
But how to specify the Parents perticular Text property ID to change its lable from its child dialog file.
-Ramesh
|
|
|
|
|