|
Hello, Im using the following line of code to draw a image in a window:
hSkinBmp=(HBITMAP)LoadImage(NULL, name, IMAGE_BITMAP, 0,0,LR_LOADFROMFILE);
HDC hdc = BeginPaint(hWnd6, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, hSkinBmp);
GetObject(hSkinBmp, sizeof(bm), &bm);
BitBlt(hdc, 2, 30, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
ReleaseDC(hWnd6,hdc);
EndPaint(hWnd6, &ps);
UpdateWindow(hWnd6);
--
And it works, the image is being drawn on the window, but then when try to run this function again to load a different image in the same window (like a slideshow), the second image is not shown on the window (the old image stays), untill I minimize and maximize the window.
What could be the reason for that?
Thx in advance
|
|
|
|
|
grep2 wrote:
And it works, the image is being drawn on the window, but then when try to run this function again to load a different image in the same window (like a slideshow), the second image is not shown on the window (the old image stays), untill I minimize and maximize the window.
I'm not sure if that's the problem, but I'd try invalidating the window before drawing the second image.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Thank you both for taking you time to answer my question, but infact the first answer solved my problem, invalidating the window area worked fine.
|
|
|
|
|
Is this by any chance in an OnDraw handler?
If so, then you should not have the UpdateWindow() at the end of the function.
If not, then the BeginPaint and EndPaint are not the proper mechanism for getting your DC, you should use GetDC and ReleaseDC instead.
BeginPaint and EndPaint are ONLY for use in the WM_PAINT or OnDraw handlers.
This is most certainly a fundamental part of your problem.
|
|
|
|
|
Hello,
when you select more than one file in the windows-explorer you can show the properties by right-clicking and choosing the item "Properties" in the shell-menu.
I need to be able to do this within my application. I use the ShellExecuteEx-function to accomplish this task. But the problem is that i can only show the properties for the first selected file. I did a google-search and tried also msdn. Maybe someone has an idee.
Best regards
Tabor25
|
|
|
|
|
tabor25 wrote:
I use the ShellExecuteEx-function to accomplish this task.
What does this code look like?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hallo David,
the code looks like this:
CString file = "";
POSITION pos = m_fileList.GetFirstSelectedItemPosition();
if (pos) {
file = m_fileTree.GetPath() + m_fileList.GetItemText(m_fileList.GetNextSelectedItem(pos), 0) + '\0';
}
if (file.GetLength()) {
SHELLEXECUTEINFO a_stInfo;
memset( &a_stInfo, 0, sizeof( a_stInfo ) );
a_stInfo.cbSize = sizeof( a_stInfo );
a_stInfo.lpVerb = _T("properties");
a_stInfo.lpFile = _T(file);
a_stInfo.fMask = SEE_MASK_INVOKEIDLIST;
ShellExecuteEx( &a_stInfo );
}
The member lpFile of the structure seems to carry only one filename. I tried to separate all selected files by using semicolon or \0 but without success. So at the moment i will show only the properties of the first selected file.
Maybe you or someone else has an idea...
Best regards
Tabor25
|
|
|
|
|
tabor25 wrote:
Maybe you or someone else has an idea...
Try IShellFolder::GetAttributesOf() instead.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
In a report style CListCtrl with multiple columns, I have traced on many CListCtrl events that the iSubItem of many ListCtrl STRUCTS is always zero eventhough the current subitem selected is on the columns other than the 1st column... For example:
<br />
void CResultsFormView::OnLvnItemchangedMyList(NMHDR *pNMHDR, LRESULT *pResult)<br />
{<br />
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);<br />
NMLVCUSTOMDRAW* pn=(NMLVCUSTOMDRAW*)pNMHDR;<br />
NMITEMACTIVATE* nm=(NMITEMACTIVATE*)pNMHDR;<br />
LPNMITEMACTIVATE temp = (LPNMITEMACTIVATE) pNMHDR;<br />
<br />
int item=temp->iItem;<br />
int subitem=temp->iSubItem;<br />
<br />
<br />
}<br />
<br />
Any thoughts on this problem...
"mustang this is ghostrider, requesting flyby..."
|
|
|
|
|
Hello
You can not select other than the 1st columns item in ListCtrl. The selection is always on the first column or it can be the whole row if you specified an appropriate style. So, for item changed event (and for most list control events) the subitem member will be 0.
Andrew
|
|
|
|
|
hello,
how can one adjust the position of the console window (default),for every c++ program in MS-visual studio 2003 environment.could there be a code for it ;is there any property settings.
my aim is to set the position of the console window at a set position for every c++ project without having to go to the dos prompt and adjust it every time.
regards
pratap
|
|
|
|
|
There is a directx driver in the windows system.
Thanks!
|
|
|
|
|
Does anyone know how to write strings into VS_VERSION_INFO?
For example i would like to change the InternalName of an executeable?
Not just version number...
any help would be much appreciated
Mepho
|
|
|
|
|
//Here goes.. this only copies ver from a src to dst file..
char srcfile[255], dstfile[255];
void changeVersion()
{
DWORD *dummy;
char *verinfo;
HANDLE hResource;
LONG lParam=0 ;
int size=0;
dummy=new DWORD;
size=GetFileVersionInfoSize(srcfile,dummy);
verinfo=(char*) malloc (size);
GetFileVersionInfo(srcfile,NULL,size,verinfo);
hResource = BeginUpdateResource(dstfile, FALSE);
if (NULL != hResource)
{
if (UpdateResource(hResource,
RT_VERSION,
MAKEINTRESOURCE(VS_VERSION_INFO),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPVOID) verinfo,
size) != FALSE)
{
EndUpdateResource(hResource, FALSE);
}
}
}
//end code
regs
|
|
|
|
|
Anyone know a way without using another source file to copy from?
any help woule be appreciated
|
|
|
|
|
|
No you can not. It wouldn't work over a proxy.
There isn't much need to throw an exception. Between HRESULT and IErrorInfo, there isn't mich you can't do as long as you aren't married to doing something that looks exactly like an exception.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Need help with this
My app. draws a continous graph in a picture box using BitBlt() function..it behaves very much like an oscilloscope...now i want to add scrolling capability so that it:
1..scrolls automatically forward with the curve
2..also user can scroll it back and forth to view the part of curve drawn earlier
thanks
|
|
|
|
|
Search a little bit on this website, there are a lot of chart controls in the "miscellaneous controls" section.
Otherwise if you want some specific help on what you did, post specific question. Because honnestly by seing your questions, the more accurate response I can give you is: add a method to your chart that will allow the user to scroll the curve. I suppose this helped you a lot isn't it ?
|
|
|
|
|
Hi all,
What functions can help me to show desktop on a computer in a private network?
Cheers,
Thanks.
G.K.Z
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
Salam,
What is the difference between #define and const int. Whether const int was present in C. If not, why it was introduced in C++?
|
|
|
|
|
A #define is just a preprocessor directive. Before the compilation, every lines in the code that match the 'first part' of the define will be 'replaced' by the 'second part' of the define. Thus there is no variable at all that is used for the define.
This code:
#define FIVE 5<br />
<br />
int Test = FIVE;
is exactly the same as this line:
int Test = 5;
|
|
|
|
|
wasife wrote:
What is the difference between #define and const int
keep in mind that #define have never been const int . you can use such a preprocessor command to replace whatever you want in the code before compile time.
such statements are fully authorized :
#define ONE_FLOAT (2.3f)
#define MAX(x,y) ((x > y) ? x : y)
and to continue on what cedric said, as the preprocessor works befor the compilation, the compiler cannot make any check on a bad "const" use with a #define...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hello,
Here are a the differences between the const variables and #define 's
The #define constant
<list> processed before compile time
ignores scoping rules (the preprocessor doens't know about scopes)
can be used in switch statements
very low type safety
const variable
<list> Processed at link time (or at runtime, i'm not sure)
Obeys scoping rules (the compiler knows about scopes)
Can't be used in switch statements, since these must have compile time constants and const variables are not compile time constants
Very high type safety
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
const variables can easily be optimized away during compilation. Otherwise they could not be used in switch statements.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|