|
How many SetPixel operations will you be performing?
If you are doing a lot, you may want to consider creating a bitmap and accessing the bits directly becuase set pixel will slow your program down by orders of magnitude.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
How many SetPixel operations will you be performing?
If you are doing a lot, you may want to consider creating a bitmap and accessing the bits directly becuase set pixel will slow your program down by orders of magnitude.
I am trying to decrypt an unknown image format! I wanted to try out different combinations and reproduce the image. We have a hard copy of the image and the image file [some kinda custom format from the mid 80s]
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Sounds interesting?
Are you doing that for fun, or have you tried to find the decoder and it is not available?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
Are you doing that for fun, or have you tried to find the decoder and it is not available?
Part fun, part serious. We have a client who's been using this image format for almost 20 years. The main program is in GWBASIC and they have this external program [written with assembler]. Partial sources available. Long assembler listings
I understand that the first 32 bytes is some kinda header. The rest of it has a lot of 0xFFs in them. I am assuming the 0xFFs are the black spaces and am making guessed at what the other bytes mean.
One problem is I don't know the width of the image in pixels!!!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish wrote:
How do I draw a pixel into a CView?
Don't, it will be dog slow. Create a DIB section instead and get direct access to the bits, then blit that bitmap to the view. It will be both much faster and easier to handle.
|
|
|
|
|
Mike Nordell wrote:
Don't, it will be dog slow
Yeah it sure was slow
So slow it looked like some kinda animation where I could see it drawing it on screen
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
I have pure Win32 based project with own message loop, something like:
CreateWindow();
for (;; )
{
EngineMain();
if(!PumpMessage()) break;
}
DestroyWindow();
When there is nothing todo (e.g. dialog is miminized) I would like to tell Windows that I'm idle. Currently the CPU consumption is allways 100%, because the message loop is running like crazy, hehe. Well, I'd like to avoid that.
thx, Moak
|
|
|
|
|
You code never blocks, like GetMessage() normally does. You need some mechanism to make your thread block (and thus receive no CPU time) when the queue is empty, then unblock when a message arrives in the queue.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork-100.10414 AcidHelm
|
|
|
|
|
thx, i did without PeekMessage and it blocks + CPU consumption is low!
|
|
|
|
|
I am just curious, how did you end up doing it?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
I am just curious, how did you end up doing it?
I'll block with WaitMessage() when there is no window visible. Member variable m_data.bVisible is set in my WindowProc callback handler (have a look on WM_SIZE).
BOOL CBlueSharkEngineWindow::PumpMessage()
{
assert(m_data.bCreated);
assert(m_pInterface);
MSG msg;
while (::PeekMessage (&msg,NULL,0,0,PM_NOREMOVE))
{
if (!::GetMessage (&msg, NULL, 0, 0))
{
m_pInterface->pConsole->Logfile(SHARKENGINE_LOG_DEBUG3, "Quit message received");
return FALSE;
}
::TranslateMessage (&msg);
::DispatchMessage (&msg);
}
if(!m_data.bVisible) WaitMessage();
return TRUE;
}
Greets, Moak
|
|
|
|
|
I think you should create a worker thread that does whatever your EngineMain funtion is doing. Thus, you can still handle all other Windows messages
Best regards,
Alexandru Savescu
|
|
|
|
|
I used SetWindowsHookEx(WH_MOUSE,....) to get mouse message.
After get mouse message(like WM_RBUTTONUP...)I need to redirect it.
For example, when user clicks right button, I want call 'Run...' dialog.
I know that I need to disable popup menu and then to do what I want it to do.
Below is my code:
HHOOK glhHook = NULL;
HINSTANCE glhInstance = NULL;
glhook = SetWindowsHookEx(WH_MOUSE, MouseProc, glhInstance, 0);
.
.
.
LRESULT WINAPI CALLBACK MouseProc(int nCode, WPARAM wp, LPARAM lp)
{
if(wp == WM_RBUTTONUP)
{
// do something....
((MOUSEHOOKSTRUCT*)lp->hwnd = NULL;
((MOUSEHOOKSTRUCT*)lp->wHitTestCode = NULL;
((MOUSEHOOKSTRUCT*)lp->dwExtraInfo = NULL;
return false;
}
}
but it still show the popup menu and ignore the action I want to do
why???
Is anybody can give me some suggestion?
|
|
|
|
|
First, make sure that your code is in a DLL, message hook procs need to be placed in a DLL.
Second, is your code not being called at all, or it is being called, but what you want to happen is not happening?
When you do get your code to happen, you will not want to send the message on to the other hooks in the chain. If you want to prevent whatever app that should receive the mouse message from displaying the context menu, the only way to do this is to make sure that they do not receive the message.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
hi, does any body know what this macro does??
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
i found it in a headfile and i have no clue
|
|
|
|
|
It will turn off name mangling for your program symbols. Which means that programs that are written in a different language besides C++ or even different C++ compilers will be able to use your code. THis also means that you will not be able to take advantage of certain C++ features like function overloading.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
well i created a dll which exports this function:
#define dllEngineExport __declspec( dllexport )
dllEngineExport inline HRESULT setAppGUID( GUID g_guidApp );
but when i come to use the dll in other apps the function works fine. but if i include that macro. ill get this error:
error LNK2001: unresolved external symbol _setAppGUID
dunno whats wrong.
|
|
|
|
|
Im trying to create a background for my application using BitBlt()
Works fine. The image includes butten (I drew some buttons on the image)
And I want them to be clickable.
How can I add a clickable zone? e.g a simple butten, but will not be visable but clickable.
thanks
|
|
|
|
|
Instead of a button use a static control. Remember to set the SS_NOTIFY style to get mouse clicks.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
You could monitor the LBUTTONDOWN and LBUTTONUP combinations to determine if the user clicked the mouse. You would then determine the rectangle where the buttons are on your image, and you could check to see which button should be clicked (if a buttons should be clicked) by testing the point that was clicked in the function PtInRect.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
fatal error RC1004: unexpected end of file found
File of interest is a header file as follows:
// define for the application icon
#define ICON_T3DX 100
// define for the application cursor
#define CURSOR_CROSSHAIR 200
// define for the application music
#define SOUND_ID_MUSIC 1
// defines for the top level menu OPTIONS
#define MENU_OPTIONS_ID_PRINT 1000
#define MENU_OPTIONS_ID_EXIT 1001
// defines for the top level menu HELP
#define MENU_HELP_ABOUT 2000
#define MENU_HELP_INSTRUCTIONS 2001
Tried including stdafx.h but it didn't fix it.
Help!
|
|
|
|
|
How does your CPP file look like. The oroblem may be because of header files included before or after. How do you know that this is the file that causes the error.
|
|
|
|
|
Message Closed
modified 21-May-21 21:01pm.
|
|
|
|
|
Suppose I have just installed VS .NET, and there were no earlier version of VC++ on my machine, would I be able to run pre-.NET applications on my machine? IOW, would I be able to run unmanaged C++ applications on my computer?
Thanks.
William
|
|
|
|
|
Of course! Do you think Microsoft would kill of such a huge amount of applications just because you installed VS.NET? Pretty much everything in the world is written in unmanaged code!
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|