|
|
Hello!
I've got handler to device context (HDC)
and array of bytes in order R,G,B,R,G,B,...
i use SetPixel for drawing above picture, but it is so slowly for large images and looks awful
Does anybody know any faster or fastest idea of displaying such RGB array?
Thanks in advance!
|
|
|
|
|
Don't use SetPixel as it is not designed to be used for displaying an entire image. You need to create a bitmap header in memory and then point the bits parameter to your array. This generally has additional problems as you must make sure that the number of pixels in a line is a multiple of 4, and are arranged in the BGR vs RGB order.
Look up CXIMage for some more information and there are likely some other tutorials in that same section.
J.
----------------------------
|
|
|
|
|
Thanks for informations, i've found CXIMage and was very usefull tutorials.
Take care!
Thank You both.
|
|
|
|
|
You might want to have a look at CreateDIBSection.
If the image is put in main mem you are only limited by available memory bandwidth when modifying it but blitting it (to video memory) is a bit slower. If you put it in video memory blitting is almost instant (well, depending on how fast/slow your video card is) but modifying the bitmap becomes a bit slower.
|
|
|
|
|
Can someone please post the lines I need to add to my INCLUDE & LIB paths to use the latest Platform SDK's with VC6?
I've been trying to use the "Setup Environment" programs that comes with the SDK, to no avail. I can neither get the paths into my VC6 options-directories nor my environment.
My attempts at setting these directories by hand have just left me with tons of build errors. Mostly "operator new does not take 3 parameters".
|
|
|
|
|
Ideally, you need to have the include, lib and bin paths in your options so that the PSDK ones are topmost. That lets you use the latest version of MIDL etc, although you need to be aware of the /no_robust switch for newer versions, as /robust is now the default.
I have the following;
"Executable files"
C:\Program Files\Microsoft SDK\Bin
C:\Program Files\Microsoft SDK\Bin\WinNT
C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
C:\Program Files\Microsoft Visual Studio\VC98\BIN
C:\Program Files\Microsoft Visual Studio\Common\TOOLS
C:\Program Files\Microsoft Visual Studio\Common\TOOLS\WINNT
C:\WINNT\system32
C:\WINNT
C:\WINNT\system32\WBEM
"Include files"
C:\Program Files\Microsoft SDK\Include
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE
C:\WINNT\system32
C:\Program Files\Common Files\System\Ado
"Library Files"
C:\Program Files\Microsoft SDK\LIB
C:\Program Files\Microsoft Visual Studio\VC98\LIB
C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB
"Source files"
C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\CRT\SRC
Hope this helps.
Steve S
|
|
|
|
|
struct Data
{
int x;
int y;
};
Data* pData = new Data[30];
how do I access value x in item 5 in the Data array
pData[5]->x = 3; // err
pData[5].x = 3; //err
/Mathias
|
|
|
|
|
The first solution is correct. The fifth item is index 4.
Kuphryn
|
|
|
|
|
My bad.
pData[5]->x = 3; // err
is not error.. it works.. i got a complie error. but now when i watch more carefully I saw that
the error was something else.. aahh stupid me.. been working to much today.
/Mathias
|
|
|
|
|
pData[5].x = 3;
Since this is an array of structures, not pointers, this is the correct way to access it. (The brackets dereference the pData pointer.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote:
The brackets dereference the pData pointer.
Actually they don't. The dereferencing has to happen explicitly, as in:
*((Data *) pData[5]).x = 3;
PLEASE IGNORE THIS INCORRECT POST. I PROMISE NOT TO REPLY TO ANY CP POSTS UNTIL I'M REASONABLY AWAKE.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
No, the second compiles just fine. He allocating an array of structures, not an array of pointers to the structure.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Gak! You're right of course!
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Does anyone know of a way to keep track of time spent on a "document" . I would like to keep track of the time a user
spends creating and working on a "document". If s/he stops for some period of time (1 minute) I want the time to stop and pick up again when they
start clicking with either the mouse or keyboard.
Thanks in advance
Tony Teveris
Gerber Scientific Products
Senior Software Engineer
Phone: 860 648 8151
Fax: 860 648 8214
83 Gerber Road West
South Windsor, CT 06074
|
|
|
|
|
That's a hard problem, unless you have a reasonably sure way of determining that the user is actually "spending time on a document".
A simplistic approach might be to accumulate the time a document view is visible and not mimimized, but that doesn't guarantee that the user is actually working on the document. Also, tracking mouse and keyboard events isn't foolproof, since the user may be reading a document without using the mouse or keyboard.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
You could write some VBA, or whatever it's called now, code that interface to a service. (I don't know enough about VBA to know how this would be done but I believe it's doable.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
If any modification the user can do causes a call to SetModifiedFlag() then you could time things of this. You would also have to take account of which view was active.
So, have a timer going once/sec in mainframe.
Any OnActivateView()/SetModifiedFLag() causes the mainframe 60 sec count to be reset.
Else, increment the active documents time variable.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
My app starts off with a splash screen,
BOOL CSTrainApp::InitInstance()
{
CWzdSplash wndSplash;
wndSplash.Create(IDB_BITMAP4);
wndSplash.UpdateWindow();
The next thing in my MDI app that shows up is the messagebox:
int nFresh = AfxMessageBox(" Revert to saved settings?", MB_YESNO);
Now when I run the app, if I click off the messagebox (without having selected Yes or No), the app gets minimized ( so far only the splashscreen and messagebox were showing). Now if I try to restore the icon, I just get the splash screen back and the messagebox is irretrievable. Even worse i can only terminate the app through the task manager. What can I do to make my messgaebox come back up when I restore the minimized app?
Thanks,
ns
|
|
|
|
|
Is the call to AfxMessageBox() in your app's InitInstance() ?
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
OOps -- forgot to say its in the OnInitialUpdate().
BTW I wanted to see where the code execution goes after OnInitialUpdate() but if I step through i end up in a disassembly window .................how does one find out which function runs next? Or is it a fact that the UI is spawned at the end of OnInitialUpdate() and the next step is eventgoverned by user action..........??
Actually I ssee that mmediately after OnInitialUpdate() ends , the UI doesnt really come up and I keep stepping through the disassembly...
Thanks!
|
|
|
|
|
This sounds familiar - I recall you were trying to do something like this some months back.- It's unwise to display dialogs from within a view's
OnInitialUpdate() handler. Instead, post an internal command to the view (eg: IDC_SHOW_MY_MESSAGE ) at the end of OnInitialUpdate() and write a handler to for that command that does the AfxMessageBox() .
- Also consider doing the
AfxMessageBox() from within InitInstance() if possible. /ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
This could well be a problem with windows XP itself.
Recently, when I try and shut down my computer when I have applications minimized, some popup a messagebox to ask a question, and XP doesnt show it. You cant switch to the application except through task manager, and then the messagebox is not shown either, and doesn't accept the keyboard input. Only option - Kill it through task manager.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Well......this is Win 2K. But yes --- same problem. This particular program I can redesign but its going to take a bit of work. Cant send it out the way it is............
|
|
|
|