|
i have try with CListCtrl you now , but it takes 5-6 mun to fill my list with data from DB and is not good maybe this is the solution my only problem is this : i want to search into DB from CEdit and i need to do fast !
Bravoone
|
|
|
|
|
Dear Bravoone_2006,
This forum is VC not SQL maybe some members dont like to see these threads that is for sql but I think you can see MSDN for learning SQl without know sql your work is hard.Two Strings first string for read of editbox and another string for sql statement and also see CString::Insert
|
|
|
|
|
seriously, did you understand what i told you yesterday[^] ???
couldn't you just write a more explicit Subject for your thread once again ?
|
|
|
|
|
Bravoone, Please remove those Guards around the title. It looks annoying.
write a function searchName that gets CString as the param.
<br />
searchName(CString)<br />
{<br />
// Though you can right a select statment straight from here, better create a stored procedure to find name.
//Call the Stored procedure here. In your stored procedure have an Ouput Parameter that returns the found name.
CString csFoundCity;
//So, you take this returned value in a CString.
<br />
m_city.SetWindowText(csFoundCity);<br />
so in m_city's onchange, call similar function that searches and fills the corresponding CEdits.
<br />
}<br />
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
can you ... write more because i dont now what do you mean ?!
Bravoone
|
|
|
|
|
hi
i m using openfilemapping function in vc++ and sometimes it will return error code 20 that means Error-bad unit.if any one knows can u please tell me what is the reason of this error and how to resolve this problem.
thanks in advance.
|
|
|
|
|
|
Can you show some code ? you are using.
|
|
|
|
|
I am creating an email client which needs to supports S/MIME . For this purpose I am using IP*Works Library. (IP*Works "SPOP" C++ Class for receiving the mails with S/MIME (Digitally signed mails.)
After receiving the digitally signed mail we needs to store the digital certificate of the sender to windows certification store just like outlook express (When a digitally signed mail is received by outlook express it stores the attached certificated in the windows certificate store and attached the certificate with public key to windows address book.)
Using IP Works I am able to get the full text of the certificate send with the digitally signed mail. but the certificate has only key public key (as i am the receiver of the mail).
Could someone suggest some API for storing the certificate with public key to windows certification store?
I has tried searching windows Crypto API but can't find any information regarding storing certificate with public key to windows certification store.
Any help would be appreciated.
|
|
|
|
|
Given a HWND, is there a reliable way or API to detect if it's a full screen window?
I was trying the following
HWND deskWnd= GetDesktopWindow();
RECT deskRect;
GetWindowRect(deskWnd, &deskRect);
HWND topWnd = GetTopWindow(NULL);
RECT topRect;
GetWindowRect(topWnd, &topRect);
But sometimes the topRect's top, bottom, left and right values are all negative, or represent a smaller rect than deskRect even though topWnd is indeed a full screen window.
I've also tried with GetForegroundWindow instead of GetTopWindow, but still no affirmative result.
Anyone knows how? Thanks.
|
|
|
|
|
Try GetWindowPlacement.
WINDOWPLACEMENT wp;<br />
wp.length = sizeof(WINDOWPLACEMENT);<br />
::GetWindowPlacement(topWnd, &wp);<br />
<br />
if ( wp.showCmd == SW_SHOWMAXIMIZED )<br />
{<br />
}<br />
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Unfortunately, it doesn't quite work because sometimes topWnd doesn't point to the correct window.
I've tried the following:
BOOL IsFullScreenAppRunning(HWND excludeWnd)
{
TCHAR tempStr[1028] = {0};
TCHAR windowTitle[512] = {0};
int result = 0;
int index = 0;
HWND firstWnd = GetForegroundWindow();
HWND nextWnd = GetNextWindow(firstWnd, GW_HWNDNEXT);
GetWindowText(excludeWnd, windowTitle, 512);
_stprintf_s(tempStr, _T("excludeWnd window title: %s\n"), windowTitle);
OutputDebugString(tempStr);
while ((nextWnd != NULL) && (result < 1))
{
_stprintf_s(tempStr, _T("loop %d)\n"), index);
OutputDebugString(tempStr);
GetWindowText(nextWnd, windowTitle, 512);
_stprintf_s(tempStr, _T("window title: %s\n"), windowTitle);
OutputDebugString(tempStr);
if ((nextWnd != excludeWnd) && IsWindowVisible(nextWnd) && !IsIconic(nextWnd) && IsZoomed(nextWnd))
{
result++;
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
::GetWindowPlacement(nextWnd, &wp);
_stprintf_s(tempStr, _T("full screen showCmd: %d\n"), wp.showCmd);
OutputDebugString(tempStr);
RECT fullRect;
GetWindowRect(nextWnd, &fullRect);
_stprintf_s(tempStr, _T("full screen rect top: %d, left: %d, bottom: %d, right: %d\n"), fullRect.top, fullRect.left, fullRect.bottom, fullRect.right);
OutputDebugString(tempStr);
GetWindowText(nextWnd, windowTitle, 512);
_stprintf_s(tempStr, _T("full screen window title: %s\n"), windowTitle);
OutputDebugString(tempStr);
}
index++;
nextWnd = GetNextWindow(nextWnd, GW_HWNDNEXT);
}
return (result > 0);
}
It also doesn't quite work. When there is a full-screen window, it can find it correctly, but when there isn't, it tends to find a regular maximized window. So, I still don't have the solution yet.
|
|
|
|
|
Hi,
I am trying to handle the wm_move or wm_moving message to keep a window within a bounding box, I am not able to stop the message from propagating once I'm done with it.
What do I need to do??
I have been messing around with this code.
Code no good, don't use :P
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
int xMin = 30, xMax = 400;
int yMin = 20, yMax = 400;
int charCount = 0;
int posX=0, posY=0;
int ret = 0;
RECT trect= { 0, 0, 0, 0 };
LPRECT rect =& trect;
switch(Msg)
{
case WM_PAINT:
ret = 0;
case WM_MOVING:
SetWindowPos(hWnd, HWND_TOP, 0, 0, 200, 200, SWP_NOSIZE | SWP_NOMOVE );
GetWindowRect( hWnd, rect );
if ( rect != NULL )
{
if ( rect->left > xMax )
posX = xMax;
if ( rect->left < xMin )
posX = xMin;
if ( rect->top > yMax )
posY = yMax;
if ( rect->top < yMin )
posY = yMin;
if ( posX > 0 || posY > 0 )
SetWindowPos( hWnd, HWND_TOP, 10, 10, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE );
}
break;
case WM_MOVE:
ret = WM_MOVE;
counter ++;
char buffer2[200];
sprintf( buffer2, "%d MOVE MESSAGES SO FAR.", counter );
charCount = SetWindowText( hWnd, buffer2 );
break;
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
return ret;
}
-- modified at 22:39 Thursday 21st September, 2006
|
|
|
|
|
beeejay wrote: What do I need to do??
Well here is a small code snippet which restricts the movement of a child dialog within it's parent dialog, may be this will help you..., this is MFC , you will have to do something similar in SDK.
void CCNonClippingChildDlg::OnMoving( int nSide, LPRECT lpRect )
{
static RECT rcPreviousCoords = *lpRect;
CWnd *pParentDlg = GetParent();
if( !pParentWnd )
return;
CRect crParentRect;
pParentDlg->GetClientRect( &crParentRect );
pParentDlg->ClientToScreen( &crParentRect );
if( lpRect->left <= crParentRect.left || lpRect->right >= crParentRect.right )
{
lpRect->left = rcPreviousCoords.left;
lpRect->right = rcPreviousCoords.right;
}
else
{
rcPreviousCoords.left = lpRect->left;
rcPreviousCoords.right = lpRect->right;
}
if( lpRect->top <= crParentRect.top || lpRect->bottom >= crParentRect.bottom )
{
lpRect->top = rcPreviousCoords.top;
lpRect->bottom = rcPreviousCoords.bottom;
}
else
{
rcPreviousCoords.top = lpRect->top;
rcPreviousCoords.bottom = lpRect->bottom;
}
}
I handled the WM_MOVING message.
|
|
|
|
|
Ok i tried somthing similiar but the window is being drawn in my location and then in the location it would be had I not interfered.
How are you calling this within the wndProcedure? Is there a window callback in mfc as there is in win32?
Thanks
|
|
|
|
|
beeejay wrote: Ok i tried somthing similiar but the window is being drawn in my location and then in the location it would be had I not interfered.
It's working fine in MFC .
beeejay wrote: How are you calling this within the wndProcedure? Is there a window callback in mfc as there is in win32?
In WindowProc you will have to do something like
LRESULT WindowProc( ... )
{
switch( message )
{
case WM_MOVING:
OnMoving( ... );
}
DefWindowProc( ... );
}
In the previous given function you will have to convert functions from MFC to SDK format. Like passing the HWND as the first parameter as required, rest will be ok...
For eg:
::GetParent( hWndChild );
|
|
|
|
|
OK it doesn't look like there is an OnMoving function within the SDK. would your program function the same way if you were just to paste the contents of your method into the WM_MOVING case?
Thanks Alot,
Ben
|
|
|
|
|
beeejay wrote: OK it doesn't look like there is an OnMoving function within the SDK.
Heh, when did I say that . I was just calling that function when the event WM_MOVING happens, in order to isolate the code.
beeejay wrote: would your program function the same way if you were just to paste the contents of your method into the WM_MOVING case?
It won't. As I said you will have to convert MFC to SDK.
For eg: GetParent( hWndChild );
Anyway here is the SDK code and don't tell me again it doesn't work...;)
case WM_MOVING:
{
LPRECT lpRect = ( LPRECT )lParam;
static RECT rcPreviousCoords = *lpRect;
HWND pParentWnd = ::GetParent( hWnd );
if( !pParentWnd )
break ;
RECT crParentRect;
::GetClientRect( pParentWnd, &crParentRect );
::ClientToScreen(pParentWnd, (LPPOINT)&crParentRect);
::ClientToScreen(pParentWnd, ((LPPOINT)&crParentRect)+1);
if( lpRect->left <= crParentRect.left || lpRect->right >= crParentRect.right )
{
lpRect->left = rcPreviousCoords.left;
lpRect->right = rcPreviousCoords.right;
}
else
{
rcPreviousCoords.left = lpRect->left;
rcPreviousCoords.right = lpRect->right;
}
if( lpRect->top <= crParentRect.top || lpRect->bottom >= crParentRect.bottom )
{
lpRect->top = rcPreviousCoords.top;
lpRect->bottom = rcPreviousCoords.bottom;
}
else
{
rcPreviousCoords.top = lpRect->top;
rcPreviousCoords.bottom = lpRect->bottom;
}
return TRUE;
}
|
|
|
|
|
Ok I have somthing very similiar, but I am still having the same problem.
The window is drawn twice, once very quickly in my position( and then erased), and then once in position it would be in had i not intervened.
Here is the code for WM_MOVING:
RECT rect;
GetWindowRect( hWnd, &rect );
if ( rect.right > xMax )
rect.left = xMax - ( rect.right - rect.left );
if ( rect.left < xMin )
rect.left = xMin;
if ( rect.bottom > yMax )
rect.top = yMax - ( rect.bottom - rect.top );
if ( rect.top < yMin )
rect.top = yMin;
SetWindowPos( hWnd, HWND_TOP, rect.left, rect.top, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE );
return true;
Thanks alot
|
|
|
|
|
beeejay wrote: SetWindowPos( hWnd, HWND_TOP, rect.left, rect.top, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE );
Well this is the problem, you don't have to do this...
Why don't you try the code that I gave, and try to see the difference.
|
|
|
|
|
I was missing this little gem LPRECT lpRect = ( LPRECT )lParam;
Thanks alot,
It seems that the rect which GetWindowRect sets doesn't actually get used after my WM_MOVING hanlder is complete.
|
|
|
|
|
beeejay wrote: It seems that the rect which GetWindowRect sets doesn't actually get used after my WM_MOVING hanlder is complete.
Read what MSDN says about lParam as on WM_MOVING event...
<code>lParam: </code>
Pointer to a <code>RECT </code>structure with the current position of the window, in screen coordinates.
<code>To change the position of the drag rectangle, an application must change the members of this structure.</code>
|
|
|
|
|
I need to learn fast about the creation of ATL Composite Control Projects.
Where could I find abundant information about this??.
Maybe a tutorial in the WEB.
Maybe a book.
I have read a lot about ATL projects but I need something specific about Composite Controls. Something that teach me how should I move inside this kind of project.
I have some good skills with MFC and I'm learning general ATL stuff.
Thank you very much.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
|
Did you see C++ Libraries On codeproject
|
|
|
|
|