|
hi all,
I want to set the WindowSize of MFC Dialog..(800 pixel width and 600 pixel height)..What is the way to do it?
If any one know this,please reply me..
Thanks in advance..
|
|
|
|
|
See SetWindowPos() and MoveWindow() .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi all:
What messages my application get when I click the system staskbar consecutively such that the dialog can get minimized and maximized!
Thanks
|
|
|
|
|
|
Hi all:
I used the DrawText() to output several lines of text within a rect, but with the font I created
VERIFY(m_Font.CreateFont(
12, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, //nOutPrecision
CLIP_DEFAULT_PRECIS, //nClipPrecision
PROOF_QUALITY , // nQuality
DEFAULT_PITCH|FF_SWISS, //nPitchAndFamily
_T("Arial"))); // lpszFacename
the text appears two crowded vertically, I know with a internal leading, the text can be looked good. But the question is how to add a internal leading?
|
|
|
|
|
IIRC SetTextMetrics might help
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Thanks for your answer. But where can I get reference for this SetTextMetrics, I can't find it in the MSDN?
|
|
|
|
|
I've managed to get myself a copy of Jeffrey Richter's Programming Applications for Microsoft Windows (4th Edition), but it doesn't have the source code CD.
Can anyone provide me with a Zipped up copy of the CD's contents please ?
|
|
|
|
|
Dear Members !
I wanted a C++ code for reading and displaying bitmap file ..
And in my code an error comes with the following :
cannot cast unsigned long to unsigned char *,,,,
in the program the error is comin on the following line :
unsigned char * VGA = ( unsigned char * ) 0xA0000000L;
can anyone help me ?
Thankx,
Sneha
|
|
|
|
|
Could you show actual CODE, where you facing Problem?
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
Hey Alok ! The following is the c++ code... and the " unsigned char *VGA=(unsigned char *)0xA0000000L; " is giving error " connot cast unsigned long to unsigned char * " Can you help me in this ?
And if you can provide me the bitmap_read code in C# then also it will be a great help .....
The following is the original code ::::::
Thanx a lot,,,
*********************************************************************
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <mem.h>
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200
#define NUM_COLORS 256
unsigned char *VGA=(unsigned char *)0xA0000000L;
void setmode(unsigned char mode)
{
union REGS i, o;
i.h.ah = 0x00;
i.h.al = mode;
int86(16, &i, &o);
}
void setrgbpalette(int n, unsigned char r, unsigned char g, unsigned char b)
{
union REGS i, o;
i.h.ah=0x10;
i.h.al=0x10;
i.x.bx=n;
i.h.dh=r;
i.h.ch=g;
i.h.cl=b;
int86(16, &i, &o);
}
void putpixel(int x, int y, char c)
{
*(VGA+((y<<8)+(y<<6)+x)) = c;
}
struct Fileheader
{
unsigned short Type;
unsigned long Size;
unsigned short Reserved1;
unsigned short Reserved2;
unsigned long OffBits;
unsigned long StructSize;
unsigned long Width;
unsigned long Height;
unsigned short Planes;
unsigned short BitCount;
unsigned long Compression;
unsigned long SizeImage;
long XPelsPerMeter;
long YPelsPerMeter;
unsigned long ClrUsed;
unsigned long ClrImportant;
Fileheader()
{
Size=Width=Height=Planes=BitCount=Compression=SizeImage=XPelsPerMeter=
YPelsPerMeter=ClrUsed=ClrImportant=Type=StructSize=Reserved1=Reserved2=
OffBits=0;
}
};
struct RGBQuad
{
unsigned char rgbBlue;
unsigned char rgbGreen;
unsigned char rgbRed;
unsigned char rgbReserved;
RGBQuad()
{
rgbBlue = rgbGreen = rgbRed = 0;
rgbReserved = 0;
}
};
class Bitmap
{
private :
Fileheader f;
unsigned char* Bmp;
RGBQuad Palette[256];
public :
void ReadBitmap(char*);
void DisplayBitmap(void);
};
void Bitmap::ReadBitmap(char *file)
{
FILE *fp;
unsigned short num_colors;
if ((fp = fopen(file,"rb")) == NULL)
{
printf("Error opening file %s.\n",file);
exit(1);
}
fread(&f, sizeof(Fileheader), 1, fp);
if (f.ClrUsed==0) num_colors=NUM_COLORS;
else num_colors=f.ClrUsed;
if ((Bmp = (unsigned char * ) malloc(sizeof(unsigned char)*(f.Width*f.Height))) == NULL)
{
fclose(fp);
printf("Error allocating memory for file %s.\n",file);
exit(1);
}
for(int i=0; i<num_colors; i++)
="" {
="" fread(&palette[i],="" sizeof(rgbquad),="" 1,="" fp);
="" setrgbpalette(i,="" (palette[i].rgbred="">>2), (Palette[i].rgbGreen>>2), (Palette[i].rgbBlue>>2));
}
for(long j=(f.Height-1)*f.Width; j>=0; j-=f.Width)
{
for(i=0;i
|
|
|
|
|
Sneha Desai wrote:
And if you can provide me the bitmap_read code in C# then also it will be a great help .....
If you looking for C# code,post your problem In C# Forum.
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi,
Try reinterpret_cast in C++.
unsigned char *VGA=reinterpret_cast<unsigned char="" *="">0xA0000000L;
Regards,
Selvam
|
|
|
|
|
I'm looking for a way to find matching regions in a file - much like the LCS (diff) algorithm, but optimized for moved data. For example in the two strings below:
"milk and coffee"
"coffee and milk"
LCS will only find a small matching region, " and ", while the strings themself have larger matching regions. Currently I'm using a "sliding windows" approach (similar to rsync) to do this, but it gets a bit slow for large files.
Any suggestions or references would be welcome - I'm looking for both heuristics and algorithms. Im also looking for traditional diff heuristics...
/Thanks
moliate
The corners of my eyes catch hasty, bloodless motion -
a mouse?
Well, certainly a peripheral of some kind.
Neil Gaiman - Cold Colours
|
|
|
|
|
Hi everyone!
I have a really silly one. Every time I close my application it ends incorrect.
In Release mode everything looks fine (some machines are showing an error, but currently not - even with the same version that did before!), but the closing is still incorrect. This means I can set an AfxMessageBox after the DoModal call in the main file for the dialog, and you will only hear the beep of the box, but the app is already gone and the box is not shown.
Unfortunally Debug mode brings no further information either!
You hear the error sound from Visual Studio debugger, but no stop or message from the debugger itself. So I can still not find out what exactly happens there! (Only the debug information about the last running thread exiting correctly with code 0, and that the program ending with code 3)
My project is already too big to give some code snippets, because it includes additional threads, "sticked" dialogs, toolbars, etc... And since I did not realize the problem early enough I could not just easily tell you what thing was included last, or how long (or already from the begin on?) the bug exists.
So finally the question: Can I set up the VS Debugger to stop in any case, even if the error is caused in some control or dll? I'd just like to know where I could start searching or what part of my app creates this problem.
Or is there some different solution to find the problem? Some free debugger? What is a typical error so the debugger brings nothing up? Any help wanted!
Thanks in advance,
Roland
|
|
|
|
|
Roland E. wrote:
This means I can set an AfxMessageBox after the DoModal call in the main file for the dialog, and you will only hear the beep of the box, but the app is already gone and the box is not shown.
This is a very common problem. The solution can be found here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Wooowdy, I love you!
You have been a real big help, it worked immediately and then I found a small bug in this never finalized end.
Again, thanks a lot!!! I wonder why I never heared about this strange behaviour...
Roland
|
|
|
|
|
hello,
I am trying to make a hookless kwylogger but I am having a
little trouble:
I am trying to use these api calls to be able to get
keyboard data from other processes:
//Attach
AttachThreadInput( MyThreadID, TargetThreadID, true);
//Detach
AttachThreadInput( MyThreadID, TargetThreadID, false);
All I do is set a timer that looks for the forground window,
get's its process ID and attach my process to it's input
queue. Then I just poll for keystrokes using
GetKeyboardState.But here I have a problem:
You see, If I was in a hook dll I would do this:
BYTE ks[256];
GetKeyboardState(ks);
scan=0;
ToAscii(wParam,scan,ks,&w,0);
but then again I'm not
so where do I get the wParam from?
Or how do I know exactely wich key has been pressed?
Don't tell me you have to try out all the possible VK codes
cause that is lame. Is there another, smarter way to do
this?
|
|
|
|
|
Have you considered using a non-exclusive DirectInput device with DirectX?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
no I haven't cause I don't know how
what's wrong with the method I wrote above?
|
|
|
|
|
As you said, you'd need to attach keyboard input to every thread you come across, and poll it with a timer, and then check all various keys whether they are pressed or not. You wanted a smarter way, so I gave you one.
Setting up DirectInput will take you about 30 minutes, it's really that easy
Take a look at this tutorial:
http://www.gamedev.net/reference/articles/article1309.asp
modified 12-Sep-18 21:01pm.
|
|
|
|
|
This is me also but I didn't bother signing on cause my net is running really poorly.
Ok, but I woun't have to carry any directx dlls and stuff with me will I ?
I mean what if some man doesn't have directx installed on his comp what then?
|
|
|
|
|
You don't need to carry any DLLs with you - every computer using Windows 98 or later has the nessesary DirectX DLLs already "on board".
Check this site:
http://www.computerhope.com/directx.htm
I'd suggest you using the DirectX 5/6 headers - there hasn't changed much in DirectInput up to Version 9, so you should be safe using the DX5/6 headers
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I cannot get the code sample "VCTerm" in VC++ 5.0, found at: DEVSTUDIO > vc > samples > mfc > general > vcterm, to work on any other computer that has not had VC++ 5.0 installed. I do not have a great deal of programming experience, but I found that the problem occurs in mainframe.cpp. The problem piece of code that fails is listed below, and the call to the section of code in commctrl.h is also listed. Any help would be appreciated.
John
mainframe.cpp
{
.
.
// Create the MSCOMM32 OLE Control.
if (!m_commctrl.Create(NULL,0,CRect(0,0,0,0),this,ID_COMMCTRL))
{
TRACE0("Failed to create OLE Communications Control\n");
return -1; // fail to create
}
.
.
}
commctrl.h
{
.
.
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x648a5600, 0x2c6e, 0x101b, { 0x82, 0xb6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14 } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }
.
.
}
|
|
|
|
|
|