|
Your idea sounds interesting but the merging process might become slow with bigger images.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Code-o-mat wrote: Your idea sounds interesting but the merging process might become slow with bigger images.
True, but my inital approach wasn't free either
And maybe you din't realized that, but had to do all the things per line. So 100 lines was 100 buffers, 100 regions, ... Now it seems i have: 1 buffer, no regions, and one time consumer. And the good news is the time consumer has no mults or divides, just some bit shifting. I'm sure performance will be much better... bet it will have a performance like a graphic filter (like emboss for ex.).
I'll try this out in the next days - thanks for the ideas...
Rozis
|
|
|
|
|
Rozis wrote: but MS itself disencourages this...
Microsoft discourages C++, too, but don't let that stop you.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Tim Craig wrote: Rozis wrote:
but MS itself disencourages this...
Microsoft discourages C++, too, but don't let that stop you.
Yep. It says: "Microsoft Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly."
What i figure out of their documentation is that the complete GDI+ classes are internally handled by their 'flat API'. This probably means: the flat api will change without any notice.
Maybe the reason they discourages C++ is that they seem to be afraid of classes.
|
|
|
|
|
May be you will have to create 32bpp DIB section and make all your drawing on it. And finally use AlphaBlend() on target DC.
|
|
|
|
|
Hi
I'm trying to get some information about the windows that working in the background.
I'm using the GetWindowRect function and it's never show me information.
here is the relevant part of my code:
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) {<br />
<br />
LPRECT lprect=NULL;<br />
cout << "hwnd_Child = " << hwnd << endl;<br />
SetWindowText(hwnd,NULL);<br />
if(GetWindowRect(hwnd,lprect))<br />
cout<< lprect->bottom<< endl;<br />
<br />
<br />
<br />
<br />
return TRUE;
}
it does change the window's text but doesn't go into the if. any idea why?
by the way how can i find the buttons inside the window?
thanks
Itay
|
|
|
|
|
Using this code : LPRECT lprect=NULL; You are sending a NULL pointer so that will cause GetWindowRect() to fail. Try the following instead:
RECT cRect;
if(GetWindowRect(hwnd, &cRect))
...
and on return cRect should contain the cx and cy values
|
|
|
|
|
Richard MacCutchan wrote:
RECT cRect;
if(GetWindowRect(hwnd, &cRect))
...
thanks. now it is working.
|
|
|
|
|
You can't get the rectangle of windows which do not belong to your own process. However, GetWindowText and SetWindowText do work between different processes. (in case you are enumerating windows of other processes also)
Additionally to what Richard MacCutchan said.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
modified on Tuesday, November 17, 2009 9:34 AM
|
|
|
|
|
Code-o-mat wrote: You can't get the rectangle of windows which do not belong to your own process.
Strange, this restriction is not noted in the MSDN documentation, but it is noted in the doc for Get/SetWindowText() !
|
|
|
|
|
I might be wrong but i think i once wanted to get the rectangle of such windows too and i couldn't get it to work so i googled around and found out that the reason was indeed that GetWindowRect can't cross processes.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
itay10 wrote: LPRECT lprect=NULL;
itay10 wrote: if(GetWindowRect(hwnd,lprect))
You cannot do this.
The pointer must hold the address of a valid struct.
change to:
RECT rect;
if(GetWindowRect(hwnd ,&rect))
BTW: why aren't you calling GetLastError ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thanks all it worked!
CPallini wrote: BTW: why aren't you calling GetLastError?
I don't know, never tried. how can it help?
|
|
|
|
|
itay10 wrote: how can it help?
Seriously? Did you read the docs to see what it does? Since the condition in the if test evaluated to false , that would indicate that GetWindowRect() returned zero.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i debugged it and i knew the returned value was zero, the question was why?
|
|
|
|
|
Calling GetLastError() would have likely told you why.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
itay10 wrote: CPallini wrote:
BTW: why aren't you calling GetLastError?
I don't know, never tried. how can it help?
Oh, don't worry about, it's a decorative function...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: BTW: why aren't you calling GetLastError?
Real men don't need GetLastError() ; what do you think CodeProject is for?
|
|
|
|
|
Richard MacCutchan wrote: Real men don't need GetLastError();
You're right: real women need GetHisLastError , while real men do need AdmitLastError .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi, I'm aiming to do something like instance a save as dialogue box have a user add input. Retrieve the file name and create the file based on the input. This is what I have so far:
OPENFILENAME _openfile;
ZeroMemory(&_openfile, sizeof(OPENFILENAME));
_openfile.lStructSize = sizeof(OPENFILENAME);
_openfile.lCustData = (DWORD)NULL;
_openfile.hwndOwner = GetFocus();
_openfile.lpstrFile = tmp;
_openfile.lpstrInitialDir = strcat(buffer, "\\Desktop\\");
_openfile.lpstrDefExt = ".xml";
_openfile.lpstrFilter = "Extensible Markup Language (*.xml)";
bool success = false;
success = GetSaveFileName(&_openfile);
HANDLE file = CreateFile(_openfile.lpstrFile, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL,
NULL);
What I was wondering is if anyone knew of an example of how to do this on codeproject. I can't seem to find one. Thanks for anything you can suggest. Nicola x
|
|
|
|
|
What is your trouble about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I cant find a full example of using GetSaveFileName, and how I can then get the file name from that (which I assumed was supposed to be passed by reference back to me?)
Have you come across an article that might help? Effectively, All i want to achieve is
Click Save as button -> GetSaveFileName()
CreateFile(filename);
but I don't know how to get the file name from the dialogue.
|
|
|
|
|
Not sure I got you, anyway an usage example is here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
OMG I dispare! The reason it wasn't working is because I'm a moron....I mean because I wasn't adding .xml to the end of the supplied file name in the gui. Doh!
|
|
|
|
|
No wait, maybe it was something else....Here is the working code for any searching people:
char buffer[256]={""};
char tmp[256]={""};
tmp[0] = '\0';
GetEnvironmentVariable("USERPROFILE", buffer, sizeof(buffer));
OPENFILENAME _openfile;
ZeroMemory(&_openfile, sizeof(OPENFILENAME));
_openfile.lStructSize = sizeof(OPENFILENAME);
_openfile.hwndOwner = GetFocus();
_openfile.lpstrFilter = "Extensible Markup Language (*.xml)";
_openfile.lpstrFile = tmp;
_openfile.nMaxFile = sizeof(tmp)/sizeof(*tmp);
_openfile.lpstrFileTitle = "Save As ...";
_openfile.lCustData = (DWORD)NULL;
_openfile.lpstrInitialDir = strcat(buffer, "\\Desktop\\"); /*virtalis_diagnostic_info.xml");*/
_openfile.lpstrDefExt = "xml";
bool success = false;
success = GetSaveFileName(&_openfile);
DWORD error = CommDlgExtendedError();
HANDLE file = CreateFile((LPTSTR)_openfile.lpstrFile,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL,
NULL);
I hope this helps some idot n00b like myself!
|
|
|
|