|
thanks Cedric
No MFC wont help me. I try to find some solution for win32
|
|
|
|
|
|
In response to WM_INITDIALOG , call GetClientRect() to get the dialog's initial size.
In response to WM_GETMINMAXINFO , set the minimum size of the dialog. If nothing else, you can use the values returned from GetClientRect() , but you might also want to consider frame and caption sizes.
In response to WM_SIZE , resize each control that is affected by the dialog's new size.
It's MFC, but I show how to do this here and here.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
I would recommend EasySize[^] by Marc Richarme[^]. I have used it in many projects over the years.
Its an absolute Meisterstück.
Best Wishes,
-David Delaune
|
|
|
|
|
Does it work with Win32 or is it MFC only ?
Watched code never compiles.
|
|
|
|
|
Well the version I am using supports both Win32 and MFC. I think I downloaded it from one of the article comments several years back. Looks like the article was geared towards MFC.
Best Wishes,
-David Delaune
|
|
|
|
|
You might want to remove the extraneous dot in those two URLs.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi DavidCrow,
Actually the trailing dot at the end of the URI is correct. It is called the root zone and is described in RFC-1034[^]. I come from a Unix backgound and have always written my URI with the DNS root zone. It is only recently within the last 2-3 years that I have noticed that certain browsers and webservers cannot handle the DNS root zone being present in the URI. I guess their 20 year old software engineers forgot to read RFC-1034.
Maybe I am just getting old. I guess the next thing that will dissapear will be the HTTP:// protocol indicator.
Best Wishes,
-David Delaune
|
|
|
|
|
I've never seen such a dot used. I can't get those URLs to work with IE or FF.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
Randor wrote: What version of IE and FF are you using?
8 and 3, respectively.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi Friends,
I am using CListCtrl all images display on the first column, but i expect a output on second column,i don't know how to display on second column. please help me.Here is my sample code for first columns image dispaly.
Code..
m_SmallImg.Create(IDB_BITMAP2, 16, 1, RGB(255, 255, 255));
m_SmallImg1.Create(IDB_BITMAP1, 16, 1, RGB(255, 255, 255));
m_List->SetBkColor(RGB(66,66,66));
m_List->SetTextColor(RGB(255,255,255));
m_List->SetTextBkColor(RGB(66,66,66));
m_List->SetOutlineColor(RGB(255,0,0));
for(int i=0;i<=6;i++)
{
LVITEM lvItem;
lvItem.mask = LVIF_TEXT | LVIF_IMAGE;
lvItem.iItem = i;
lvItem.iSubItem = 0;
lvItem.iImage = i % 2;
lvItem.pszText = " sModelName ";
i = m_List->InsertItem(&lvItem);
m_List->SetItemText(i, 1, " TagName ");
m_List->SetItemText(i, 2, " UserName ");
m_List->SetItemText(i, 3, " Descddfgdfgfggdf ");
}
|
|
|
|
|
|
Hi,
I have a doubt regarding multimap::equal_range function for the following program.
int main ()
{
multimap<char,int> mymm;
multimap<char,int>::iterator it,it1,it2;
pair<multimap<char,int>::iterator,multimap<char,int>::iterator> ret;
mymm.insert(std::pair<const char,int>('a',10));
mymm.insert(std::pair<const char,int>('b',20));
mymm.insert(std::pair<const char,int>('b',30));
mymm.insert(std::pair<const char,int>('c',40));
mymm.insert(std::pair<const char,int>('b',50));
mymm.insert(std::pair<const char,int>('c',60));
mymm.insert(std::pair<const char,int>('d',70));
cout << "mymm contains:\n";
for (char ch='a'; ch<='d'; ch++)
{
cout << ch << " =>";
ret = mymm.equal_range(ch);
it1 = ret.first;
it2 = ret.second;
cout << (*it1).second << " " << (*it2).second << endl;
for (it=ret.first; it!=ret.second; ++it)
cout << " " << (*it).second;
cout << endl;
}
return 0;
}
It is giving following output:
mymm contains:
a =>10 20
10
b =>20 40
20 30 50
c =>40 70
40 60
d =>70 70
What I am not getting is the o/p for 'b'. I think it should be
b =>20 60
20 30 50
Please revert.
BR,
Akash
|
|
|
|
|
The output is correct, the map is orderd by the key.
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]
|
|
|
|
|
Some suggestions:
- Use
typedef s:
typedef multimap<char,int> char2int;
typedef char2int::iterator char2map_it;
char2map mymm;
char2map_it it,it1,it2;
pair<char2map_it, char2map_it> ret;
There's no need to repeat long type names all over the place. One design decision should, if possible, be expressed in one place (or as few as possible): Now I can change from a map from char s to int s to a map from char s to std::string s by changing one line, for example.
- Use
make_pair from #include <utility> :
mymm.insert(make_pair('a', 10));
None of this is related to your question...
Steve
|
|
|
|
|
hi friends,
class MyEchoSocket : public CAsyncSocket
{
public:
virtual void OnAccept(int nErrorCode);
virtual void OnClose(int nErrorCode);
virtual void OnConnect(int nErrorCode);
virtual void OnOutOfBandData(int nErrorCode);
virtual void OnReceive(int nErrorCode);
virtual void OnSend(int nErrorCode);
};
class CServerDlg : : public CDialog
{
public:
void OnReceive();
void OnClose();
void OnAccept();
void OnSent();
CSolusServerDlg(CWnd* pParent = NULL); // standard constructor
};
void CServerDlg::OnAccept()
{
CString strIP;
UINT port;
if(m_sListener.Accept(m_sConnected))
{
m_sConnected.GetPeerName(strIP,port);
m_status = strIP ;
UpdateData(FALSE);
}
else
{
AfxMessageBox("Cannot Accept Connection");
}
}
this above code is crasing 2nd client accepting or multiple client trying to connect
please help me...
|
|
|
|
|
Member 3653751 wrote: this above code is crasing...
Which is fairly meaningless given that you've provided no context, or stated exactly what is happening. By "crash" do you mean an exception is thrown, an assertion is fired, or something else? Please elaborate. Have you used the debugger to narrow the problem down?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Debug asseration Failed...
Program:c:\bujji\server\Debug\server.exe
file : sockcoare.cpp
line: 177
for more information on how your program can cause an asseration failure,
see the vusial c++ Documentation on asserts.
please help
|
|
|
|
|
Member 3653751 wrote: file : sockcoare.cpp
line: 177
Locate the source file, and take a look at line 177 to see which condition is failing. That should get you started.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hello guys,
I'm trying to write a funtion to read a simple bitmap, but I've encountered a serious problem.
As model I used the description of the bitmap file format from wikipedia http://en.wikipedia.org/wiki/BMP_file_format[^] and as far as I know this is definitely the correct format.
I also used the same 2x2 24-bit bitmap[^] to test my function, but except for the first value (the magic number or identifier) all other read values are wrong.
#include <stdint.h>
#include <stdio.h>
typedef uint8_t BYTE;
typedef uint16_t BYTE2;
typedef uint32_t BYTE4;
typedef struct BMP_FILE_HEADER
{
BYTE2 MagicNumber;
BYTE4 FileSize;
BYTE2 Reserved1;
BYTE2 Reserved2;
BYTE4 Offset;
} BMP_FILE_HEADER;
typedef struct BMP_INFO_HEADER
{
BYTE4 HeaderSize;
BYTE4 ImageWidth;
BYTE4 ImageHeight;
BYTE2 NumberOfColorPanels;
BYTE2 ColorDepth;
BYTE4 Compression;
BYTE4 ImageSize;
BYTE4 HorizontalResolution;
BYTE4 VerticalResolution;
BYTE4 NumberOfColors;
BYTE4 NumberOfImportantColors;
} BMP_INFO_HEADER;
typedef struct BITMAP
{
BMP_FILE_HEADER bmpFileHeader;
BMP_INFO_HEADER bmpInfoHeader;
BYTE* bmpData;
} BITMAP;
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
#define BI_BITFIELDS 3
#define BI_JPEG 4
#define BI_PNG 5
BITMAP readbmp(const char* _pcFileName)
{
FILE* bmp = fopen(_pcFileName, "rb");
BITMAP bitmap;
fread(&bitmap.bmpFileHeader, sizeof(BMP_FILE_HEADER), 1, bmp);
fread(&bitmap.bmpInfoHeader, sizeof(BMP_INFO_HEADER), 1, bmp);
fseek(bmp, bitmap.bmpFileHeader.Offset, SEEK_SET);
bitmap.bmpData = (BYTE*)malloc(bitmap.bmpInfoHeader.ImageSize);
fread(bitmap.bmpData, bitmap.bmpInfoHeader.ImageSize, 1, bmp);
fclose(bmp);
return bitmap;
}
To test my function i wrote a short program, which reads the above mentioned bitmap.
#include <iostream>
#include "readbmp.h"
#define DBG(x) (cout << #x << "\t:\t" << (x) << endl)
using namespace std;
int main(void)
{
BITMAP myBmp;
myBmp = readbmp("..\\bmp24.bmp");
DBG(myBmp.bmpFileHeader.MagicNumber);
DBG(myBmp.bmpFileHeader.FileSize);
DBG(myBmp.bmpFileHeader.Reserved1);
DBG(myBmp.bmpFileHeader.Reserved2);
DBG(myBmp.bmpFileHeader.Offset);
DBG(myBmp.bmpInfoHeader.HeaderSize);
DBG(myBmp.bmpInfoHeader.ImageWidth);
DBG(myBmp.bmpInfoHeader.ImageHeight);
DBG(myBmp.bmpInfoHeader.NumberOfColorPanels);
DBG(myBmp.bmpInfoHeader.ColorDepth);
DBG(myBmp.bmpInfoHeader.Compression);
DBG(myBmp.bmpInfoHeader.ImageSize);
DBG(myBmp.bmpInfoHeader.HorizontalResolution);
DBG(myBmp.bmpInfoHeader.VerticalResolution);
DBG(myBmp.bmpInfoHeader.NumberOfColors);
DBG(myBmp.bmpInfoHeader.NumberOfImportantColors);
cin.get();
return 0;
}
This code just writes out the header informations as following:
myBmp.bmpFileHeader.MagicNumber : 19778
myBmp.bmpFileHeader.FileSize : 0
myBmp.bmpFileHeader.Reserved1 : 0
myBmp.bmpFileHeader.Reserved2 : 54
myBmp.bmpFileHeader.Offset : 2621440
myBmp.bmpInfoHeader.HeaderSize : 131072
myBmp.bmpInfoHeader.ImageWidth : 131072
myBmp.bmpInfoHeader.ImageHeight : 65536
myBmp.bmpInfoHeader.NumberOfColorPanels : 24
myBmp.bmpInfoHeader.ColorDepth : 0
myBmp.bmpInfoHeader.Compression : 0
myBmp.bmpInfoHeader.ImageSize : 247660544
myBmp.bmpInfoHeader.HorizontalResolution : 247660544
myBmp.bmpInfoHeader.VerticalResolution : 0
myBmp.bmpInfoHeader.NumberOfColors : 0
myBmp.bmpInfoHeader.NumberOfImportantColors : 0
What am I doing wrong? It looks as if the parameters are in a wrong order, even though I used the one described on wikipedia.
Thanks for your help.
|
|
|
|
|
This is because the compiler will add padding-zeros in the structure to align the different members on a specific boundary. You can read more about the subject here[^] (or google to find additional information).
To disable that, you have to pack your structure on a 1 byte boundary using #pragma pack(1) . See here[^].
On the other hand, why are you writing the code to read a bitmap ? There are already quite some libraries which can do that, so why reinventing the wheel ? (unless for learning purpose, in which case it is understandable).
|
|
|
|
|
Learning purpose ... not really. I know that there are a lot of libraries out there, which can load bitmaps. Actually I was just bored to death and wanted to do something. And I wanted a bitmap structure/class which gives me full control over all parameters and single values.
Oh, and thanks, the parameters are now displayed correctly. There is just one thing I do not understand: The value which contains the image size is always 0x00.
|
|
|
|
|
Manfr3d wrote: There is just one thing I do not understand: The value which contains the image size is always 0x00 It may be you won't need to use image-size, just width and height, and so don't need to worry too much about it. A quick search of (a limited amount of) code on my laptop that deals with bitmaps did not find it being used. Though Width and Height occur all the time as in a call to, for example, the Win32 function:
BitBlt(hDC,xDest,yDest,bmInfo.biWidth,bmInfo.biHeight,hDCMem,0,0,SRCCOPY);
|
|
|
|
|
Yeah, I think you're right. However, the image size would make memory allocation easier.
|
|
|
|
|