|
In a 24 bit bitmap, every pixel is stored in 24 bits but every row is aligned on a DWORD (32 bit) boundary. So in your loop when you reach the end of a row, you have to reset your pointer to the next 32 bit offset from the start of the bitmap data.
BYTE *dst=(BYTE*)pBits;
for (int dh = 0; dh < bm.bmHeight; dh++)
{
for (int dw = 0; dw < bm.bmWidth; dw++)
{
dst[0]=(BYTE)nBlue;
dst[1]=(BYTE)nGreen;
dst[2]=(BYTE)nRed;
dst += 3;
}
dst = (BYTE *)(((DWORD)dst + 3) & ~3);
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
That's much better than mine!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I want to know where I have to write the to the registry so a certain type of extension will be opened with a certain program and a way to write there certain parameters for my app.
I am desinginig a win32app and I want to know how can I have some argument vectors for it.
gabby
|
|
|
|
|
Figure it out yourself. Make a new file with a new extention, try .xyz Try open it. Select always open it with some program. And then check the regedit.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
I always setup file associations in my apps installer. That way the associations are removed along when the app is uninstalled. The installer I use, InnoSetup, as a FAQ page that lists the registry entries needed to set up file associations: http://www.jrsoftware.org/isfaq.php#assoc[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Problem description:
I realized my own Memory allocator that is returned by calls to "CoGetMalloc" function (i use a hooked function)
I created a DLL that on its initialization phase replaces the original memory allocator for the process (that loads this DLL), and points it to mine
i return a pointer to my memory allocator instead of the default one.
My memory allocator simulates the original, but uses my own heap.
here's what i do:
1. I use a DLL injector EXE application which injects a dll to a process - the DLL name is sent as a parameter.
2. i added "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MyProcess.exe" to the registry,
and pointed it to the injector application with my DLL as its parameter.
The flow if what i expect to happen is this:
1. I execute "MyProcess.exe"
2. "MyProcess.exe" process is created and does nothing
3. The injector is executed, and injects my dll to "MyProcess.exe"
4. The injector activates the loadlibrary function which calls the initialization section in my DLL
5. This section hooks to the "CoGetMalloc" function, which uses my own memory allocator. (anyone who calls it, will get my memory allocator from now on
in this process)
6. the original "MyProcess.exe" is executed, but blindly using my memory allocator and heap instead of the default ones.
What actually happens is that i get a crash after few times the "Alloc" method is invoked, but i can't understand why. "Alloc" is the only method that
was called after launching "MyProcess.exe".
Can anyone see the problem with this scenario?
Thanks.
|
|
|
|
|
Hi,
I am developing Icon Editor Application in MFC. I have knowledge of handling bitmaps in MFC but I don't know how to handle Icons in MFC. Please tell me if there are any SDK for handling Icons in VC++. or I have to do it by using C. If I have to handle it by using C then tell me what is the format of Icons. Please help me in this regard.
Thanks in Advance.
Promise
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
I need variables which can have, beside a value, an empty and invalid state (like in DB's NULL etc).
With templates this is no problem to code this but I can't think of a short name for this?
template fancy<int> Parameter;
if(Parameter == fancy::valid)
{
}
|
|
|
|
|
If I understand your question correctly, do you mean you want to call your variables like this
class::variable
?
If yes, then simply make them static.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
No. You can safe for example values from 0 to 255 in a char. I need also the values 'empty' and 'invalid'.
Therefore I created a template, so I can declare a variable like: fancy<char> MyVar;
Problem is, I can't think of a name for the template.
|
|
|
|
|
I forgot to check: Do not treat <'s as HTML tags
fancy<char> MyVar
|
|
|
|
|
Hello.
Does anyone know how to upload files to web server through HTTP by VC++?
Thanks!
Help
|
|
|
|
|
|
Thank you very much!
Help
|
|
|
|
|
Merry Christmas, fellow programmers.
I have a question about the pictureBox. I'm writing a Chechers game using Managed C++ and Windows Form. I have a Checkerboard picture, named "checkerBoard.png". Then I added a pictureBox in Windows Form, and it gives me a line of code in the InitializeComponent() method like this:
this->pictureBox->Image = (__try_cast<system::drawing::image *="">(resources->GetObject(S"pictureBox.Image")));
My question is, how do I draw another pictures on the pictureBox? I have other Checkers images that needed to be drawn on top of the pictureBox. That line of code looks to me like it's been drawn in the Windows Form. How do I draw other image on top of the pictureBox, and those checkers images need to be redrawn at runtime under certain conditions.
Thanks
|
|
|
|
|
in my MFC Dll, I want to have message handler, such as OnTimer().
in the MFC Dll, I want to set the timer in the exported function, which is called by external program, how can I do that?
thanks very much
|
|
|
|
|
Create a (hidden) window - that's it.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi!
Where can I get the Microsoft Windows .NET DDK?
Thanks!
|
|
|
|
|
You can order it from Microsoft (for free but shipping is quite expensive). There is imho no more download possibility except you have a MSDN subscription.
|
|
|
|
|
I want to change mdi child frame window size, instead of default size. I know I could change it at PreCreateWindow(). but at that time it's not known what size it should be. the size depends on view. so I change the size at view::InitialUpdate(), but it won't work.
void CMdiView::OnInitialUpdate()
{
// TODO: Add your specialized code here and/or call the base class
CChildFrame* p = (CChildFrame*)GetParent();
p->OnSize( SIZE_RESTORED, 800, 800 );
CView::OnInitialUpdate();
}
Can anybody tell me why?
|
|
|
|
|
I subclassed ToolBarWindow32 in "x" application successfully
I also Added one button with resourse id as ID_NEW_BUTTON successfully to this toolbar at runtime.
Now problem is I want to trap one event if user clicks on my Button, I am failing to do so..
FYI
in "x" application ToolBarWindow32 is a child of Rebar control
here is my Hook Function which is not doing what I want..
LRESULT CALLBACK ToolBarProc(HWND hWnd, UINT dwMsg, WPARAM wParam, LPARAM lParam)
{
switch (dwMsg)
{
case WM_LBUTTONDOWN:
if ( (LONG) LOWORD(wParam) == ID_NEW_BUTTON )
MessageBox( NULL, _T("Our Button Clicked"), _T("OEEXpress"), MB_TOPMOST );
}
// Pass message on to the original window procedure*/
//return CallWindowProc( (WNDPROC)g_toolbaroriginalHandler, hWnd, dwMsg, wParam, lParam );
}
Any Idea whats going wrong..
and help is greatly appreciated..
|
|
|
|
|
This time I don't want to ask you guys for help, but I like to give you an advise. BELIEVE IN YOURSELF, THAT'S THE ONLY WAY TO ACHIEVE WHAT YOU WANT.
A few months ago I asked here a question about a problem I had during debugging my own written application. And there was somebody tried to insult me by saying that, what I was doing, it was too complex for me. Actually I didn't like his answer , I had the feeling he's a selfish person . So I continued my search for a solution of my problem and finally I found it.
Now my application (for client/server chat) is working well, I like to share my experience with you that you have to believe in your capability. Don't let other people destroy your dream.
And I also want to thank other programmers here who make time free to answer questions.
Greetz Nordin from Holland.
|
|
|
|
|
This is soapbox/lounge material
Secondly...
The response you got was probably due to you asking a vague question...
Like:
I'm using a CListCtrl and I can't add items...
When I read questions like that I answer with...
Your probably not experienced enough...go back to using VB. If your too lazy to narrow your problem to something more specific, then I assume it's laziness or inexperience in debugging...
You are right about believing in yourself...thats key to success...so instead of asking a question the minute something goes wrong, have faith in yourself and narrow your problem down until you either solve it or it's specific enough someone knows whats going on and it can be answered.
I'm sure many of us are guilty of jumping the gun and posting a question before we even try to solve it (myself included) but atthe same time you can't be mad when someone gets disappointed by your lack of interest in your own source code...and makes a comment like...your a beginner or whatever...
Just my 2 cents...
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
:-DGood answer!
Question: Why does this not work?
"char *ch; ch = 'a';"
Answer: Because you do not know what you are doing!
At least that is what I feel like saying.
Usualy I try to solve the problem myself. So that by the time I do ask a question there are very few peaple who can answer it.
Once in a while I'll ask a question while in the middle of researching for the answer, in hopes that I can short cut my research a little.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I generally reply like that because I want to scare you. You are over your head when you ask some questions, and you have two choices. Giving an answer your your question is the wrong thing to do, because you need to learn to research this on your own (often for other useful information you will learn while finding the answer).
Your first choice when this happens is to push on through, believe in yourself, and just solve it no matter how hard it is. It will take time and effort, but you become a better person for it.
The other choice is to give up. This takes no effort, but it doesn't waste your time, nor does it waste our when when you hit the next road block (should we answer the question) that you can't solve. For most people this is the right thing to do, simply because they will give up eventially anyway.
You are one of the rare people who fall into the first catagory. Now take a step back, would you have learned as much about the problem if we gave you all the answers? Could you even have solved it? My guess is you learned a lot along the way, much of which is important, but not something you would have thought to ask.
|
|
|
|