|
dialogs are unresizable by default, and you can disable the max/min/restore buttons in the resource editor.
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
hmmm, well my dialog is resizable. Do you know what the default settings are? When it is a popup or overlapped dialog it crashes when the program starts. When it is a child it works, but I can't add/remove the min and max buttons. It is a dialog based app. Is that the problem?
-Raffi Yet another example of my bad programming skills.
|
|
|
|
|
oh, i fixed it. really stupid.
-Raffi Yet another example of my bad programming skills.
|
|
|
|
|
go in the resource editor, open your dialog. click the Styles tab. choose "Dialog Frame" as the border type. click Title Bar and System Menu. (and min/max boxes, if you want). those are the defaults.
c
Garbage collection, making life better - for weenies!
|
|
|
|
|
The unhanlded exception error appears at different times when i run this code. Sometimes when i is 100 and sometimes when it's 500.
for (i = 0; i < horzres*vertres; i++)
{
bInfo.bmiColors[i].rgbRed = GetRValue(pCol[i]);
bInfo.bmiColors[i].rgbGreen = GetGValue(pCol[i]);
bInfo.bmiColors[i].rgbBlue = GetBValue(pCol[i]);
bInfo.bmiColors[i].rgbReserved = 0;
}
Thanks very much in advance!
|
|
|
|
|
If you're trying to fill a bitmap with data, they are word aligned internally, and you need to skip the padding at the ned of each row. My GDI+ image processing articles show how - the principle is the same in C++/GDI because the internal structure is the same.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
bmiColors is the palette, not the image.
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
The BITMAPINFO struct is defined as follows:
typedef struct tagBITMAPINFO {
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO, *PBITMAPINFO;
It's the bmiColors[1] property i'm confused about. This requires an array to RGBQUAD structs and all i have is a pointer to an array of them, how do i use the pointer when it wants an array?
Thanks
|
|
|
|
|
MSDN :
The RGBQUAD structure describes a color consisting of relative intensities of red, green, and blue.
typedef struct tagRGBQUAD { // rgbq
BYTE rgbBlue;
BYTE rgbGreen;
BYTE rgbRed;
BYTE rgbReserved;
} RGBQUAD;
Members
rgbBlue Specifies the intensity of blue in the color.
rgbGreen Specifies the intensity of green in the color.
rgbRed Specifies the intensity of red in the color.
rgbReserved Reserved; must be zero.
Remarks
The bmiColors member of the BITMAPINFO structure consists of an array of RGBQUAD structures.
And keep in mind that an array is a pointer!
u can always write:
int a[5];
a[1] = 2;
*(a+1) = 3; // Means a[1] = 3;
Papa
Murex Co.
|
|
|
|
|
This bmiColors is the tip of a variably-sized array of RGBQUAD s. Suppose for instance your palette has nBmiColors entries, you'd allocate and stuff the thing like this:
unsigned nBmiColors=256;
BIMAPINFO* lpbmi=(BITMAPINFO *)malloc(
sizeof(BITMAPINFO)+
nBmiColors==0?0:(nBmiColors-1)*sizeof(RGBQUAD));
for(unsigned n=0;n<nBmiColors;++n)
{
lpbmi->bmiColors[n]=...;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello,
I don't know if someone could help me with this, but if they could I would very much appreciate it. I created a very basic MDI application to let me open Bitmaps. So that works fine. I click Open, select a bitmap, voila, my Bitmap appears!
But, when I start this program, it comes with one blank window open. If I decide to close this window (or if at any time I decide to close all windows) and have no windows open, I encounter a problem I'd like to fix. If I hit Open, and select a Bitmap, it opens a new window, but no bitmap appears. It is simply a blank window. I want the bitmap I had chosen to appear.
I tried to use OnFileNew, or even CWinApp::OnFileNew, but it tells me these methods are protected. If I take them out of protected and make them public, funny enough, it STILL says they are protected. I am sure that making them public instead of protected is the wrong way to do this, but I am currently out of ideas.
If anyone knows how to make file->open open a new window as well, I'd really like to know how you do it.
Thanks a whole lot,
Nick One
|
|
|
|
|
The CDocument derived class has an OnNewDocument method ( or something similar ), and that is where you want to do it.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
To stop a window being opened at the the start of your application:
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing ;
Just before the call to ProcessShellCommand()
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi,
I have a MDI program, this program starts a Dialog using doModal function, but this function stop the main window, and wait for a user resp (press Ok or Cancel). I need that this main window don't stop ..
How can I do that?
|
|
|
|
|
Use a modeless dialog (search for info on your docs, basically you create and show the dialog without calling DoModal and keep on with your program, later on someone has to take care of destroying the dialog when the window associated exits.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Do you want to create a splash screen?
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I believe this has been a very long time(over 3 years) problem that no one in CP has figured out(or has claimed that they do) a solution to solve:
How do you send email in your C/C++/MFC programs if the SMTP server requires authentication?
Note: nowadays it's like 99.99% of SMTP servers in the world require authentication, damn it.
|
|
|
|
|
Anonymous wrote:
How do you send email in your C/C++/MFC programs if the SMTP server requires authentication?
You write the code yourself instead of using some built-in systems which can't.
Take a look at RFC2554 it says it all.
Basicly you send an AUTH command to the server, then it sends a Base64 encoded string back to you asking for a username, then you send the (Base64 encoded) username back to the server, then it asks for the password, and you send the password to the server.
Depending on what the server supports the "encoding" can also be MD5-Cram or MD5-Digest checksums instead of Base64 encoding.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Cool I want to know that, but where do you find article "RFC2554", I tried to search it on Yahoo and got a dead link.
|
|
|
|
|
See this link.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
http://rfc.net/rfc2554.html
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
In addition to what Anders said, some SMTP servers behave differently. They have a corresponding POP server and when you POP successfully from it, your IP address is added to an allowed list for a fixed time interval. During that time you can use the SMTP as a relaying SMTP, else it will ask you to authenticate once via POP.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
Yea, but thats baaaad behavior, because most mailprograms sends before they receive.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi all,
I am having a very strange problem with exception handling and variants. Here is a complete sample program that I have reduced the problem down to.
#include "stdafx.h"
#include <comdef.h>
class X
{
public:
VARIANT Test(BSTR name) const
{
VARIANT v;
VariantInit(&v);
return v;
}
};
int Test()
{
int index = 0;
try
{
throw 10;
X obj;
obj.Test(L"hi");
}
catch (...)
{
index = -1;
}
return index;
}
int main(int argc, char* argv[])
{
int i = Test();
return 0;
}
If anyone can give any insight as to why this problem occurs or how to get around it I would greatly appreciate it.
Thank you
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!
|
|
|
|