|
i think you are using a CScrollView.. you can use the CScrollview::SetScaleToFitSize(SIZE new_size) All you have to do is to give in the new size of the window
for more informations in how to use this.. contact msdn.. or ask me..
|
|
|
|
|
I have an sdi app, that has no document. I probably could have created my app as dialog based. Anyway, my app is just about finished (so I don't want to go back and make it dialog based) and my window title always says "Untitled - [my app name]". How can I get rid of the "Untitled".
Thanks, John.
|
|
|
|
|
Add this to PrecreateWindow in Mainframe
cs.style &= ~(LONG) FWS_ADDTOTITLE;
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Use the api SetWindowText(..)
|
|
|
|
|
the following code causes a break in a debugging session to a user breakpoint and then shows a memory leak.
CString *temp;
temp = new CString();
delete temp;
I actually boiled it down to that. Any idea what's wrong? Should I just not create pointers to CString objects? Major thanks in advance
--
Peace,
Amit Jain
|
|
|
|
|
do:
pTemp = new CString;
no parenthesis.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
No go I get the same errors...
Thanks for trying though
--
Peace,
Amit Jain
|
|
|
|
|
This works for me just fine:
CString* lpszMyString = new CString;
delete lpszMyString;
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
You're right, it should work perfectly, I have absolutely no idea why it doesn't work for me
--
Peace,
Amit Jain
|
|
|
|
|
I apologize, and I thank those who answered. The problem turned out to be a with the project file... Deleting and recreating it eliminated the problem.
--
Peace,
Amit Jain
|
|
|
|
|
I'm trying to use Direct Input 8 to navigate my SpaceShip. But I cant get DirectInput 8 to work. I read the whole Tutorial about Keyboard inputs that comes with the DirectX8 Docs, Heres the Code!
To Int the DirectInput Object i did:
-----------------------------------------------------
//Put this in WinMain()
hr = DirectInput8Create(hInst, DIRECTINPUT_VERSION,
IID_IDirectInput8, (void**)&g_lpDI, NULL);
if FAILED(hr)
{
// DirectInput not available; take appropriate action
}
LPDIRECTINPUTDEVICE8 g_lpDIDevice;
hr = g_lpDI->CreateDevice(GUID_SysKeyboard, &g_lpDIDevice, NULL);
if FAILED(hr) {
DI_Term();
return FALSE;
}
hr = g_lpDIDevice->SetDataFormat(&c_dfDIKeyboard);
if FAILED(hr) {
DI_Term();
return FALSE;
}
// Set the cooperative level
hr = g_lpDIDevice->SetCooperativeLevel(hWnd,
DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
if FAILED(hr) {
DI_Term();
return FALSE;
if (g_lpDIDevice) g_lpDIDevice->Acquire();
}
no Compile Error!
A function to check if the key is pressed.
----------------------------------------
void WINAPI ProcessKBInput()
{
#define KEYDOWN(name, key) (name[key] & 0x80)
char buffer[256];
HRESULT hr;
PlayerX++;
hr = g_lpDIDevice->GetDeviceState(sizeof(buffer),(LPVOID)&buffer);
if FAILED(hr)
{
// If it failed, the device has probably been lost.
// Check for (hr == DIERR_INPUTLOST)
// and attempt to reacquire it here.
return;
}
// Turn the spaceship right or left
if (KEYDOWN(buffer, DIK_RIGHT))
{
PlayerX++;
}
}
No Compile error
But I need some way to execute the function, and in the Documents that MicroSoft released, there was no example
I tried to put ProcessKBInput();
in my ProcessNextFrame(); function.
no compile error, but my program crashes every time i ran it. No error message just turns black for a few seconds and then back to windows!
Hope any one get an ideer what my problem is.
Thanks
PS: Am not a super programmer so dont taunt me if its a easy thing to fix, okay?
|
|
|
|
|
If you're getting a super frame rate, calling this function when you draw a frame could mean it's getting called a LOT. I don't see any problem with your code, but what you should do is use timeGetTime() to track how long it's been since you last checked key status, and move your ship by an amount that takes this into account. Otherwise the movement speed will be erratic depending on your frame rate, and different from one machine to the next. The same is true of all movement that occurs.
Does your program draw OK if you DON'T check the keyboard input ? I'd be checking other areas, and for the crash ( have you gone into the debugger to see *where* the crash is occuring ), I'd make sure that you've not got values spiralling out of control somewhere.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I tried to run my Program in Debuged mode, the program didnt crash, it just turned white!! I couldnt close it! I restarted my Computer...
If I remove the ProcessKBInput(); My Program runs fine.
if i create a simple keyboard input for windows
like:
case IDM_DOWN:
ProcessKBInput();
return 0L;
and put my ProcessKBInput(); in it, it runs, but if I hit the key that will execute ProcessKBInput my program will crash with no error message!
So I think that it is my ProcessKBInput Function that has the flaw!
|
|
|
|
|
So.. i need to send from VB6 a STRUCTURED ARRAY into a VC++ DLL!!
i just prepared this 2 file:
VB6 EXE FILE
------------
public type secondarr
value1 as long
value2 as long
end type
publit type strarr
superarr() as secondarr
value3 as long
end type
Private Declare Function tryout Lib "<myc++lib>" (Byref PArr as strarr) as long
public sub PassArray()
dim myarr(0) as starr
redim myarr(0).superarr(0)
myarr(0).value3=3
myarr(0).superarr(0).value1=1
myarr(0).superarr(0).value2=2
msgbox tryout(myarr(0))
end sub
VC
----
[this is a Dynamic-DLL]
[....]
//only function and struct here
[in h]
struct secondarr
{
int value1;
int value2;
};
struct strarr
{
secondarr* superarr;
int value3;
};
[in cpp]
int tryout(strarr * myarr)
{
return strarr[0].superarr[0].value1; // <-- don't work
return stratt[0].value3; // <-- work correctly...
};
...................
so where is the problem????
i need to read a substructired array but... in this case i only operate on first level of array....
any one has other solution???????
thx....
|
|
|
|
|
Hi,
I created a dialog based application with two ActiveX controls on it, one is placed on the dialog resource and the other is created using the Create(...) function. When I run the application on Win98 it works fine, if I run it on Win2000 it doesn't work at all. I stepped into the code on both machines and found that the Win2000 machine hangs on line 326 of DLGCORE.CPP
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,
pParentWnd->GetSafeHwnd(), AfxDlgProc);
As I was tracing through the code, it looks like all the correct variables are loaded but it always just stops on that line of code, no return, no nothing.
Does anyone know of any steps I can take to try and find out why this is happening?
Thanks in advance,
Craig
|
|
|
|
|
As soon as I hear ActiveX, I think licensing issues. Are any of the controls you are talking about third-party controls or are they your own code? If they are 3rd party, then they may need to be passed a license key before they will work on a non-development machine.
CodeGuy
http://groups.yahoo.com/group/wtl
|
|
|
|
|
Hi CodeGuy,
Thanks for the suggestion, it is a third party control but after reading the documentation it doesn't seem to need a license. I've actually just used it as a COM control and it seems to work as expected.
Thanks again for your help,
Craig
|
|
|
|
|
I am unable to disable dialog bar buttons. No matter which button, or where I do it from, it enables itself right after I disable it.
Any ideas?
|
|
|
|
|
|
Consider the following code. I'm trying to use path to create a region.
I cant understand why
CMyView::OnDraw( CDC* pDC)
{
RECT client;
pDC->GetClientRect( &client);
pDC->CSetMapMode( hDC, MM_ISOTROPIC);
int winExtX=1000;
int winExtY=1500;
pDC->SetWindowExt( winExtX, winExtY);
int viewPortExtX=client.right-client.right/5;
int viewPortExtY=-client.bottom+client.bottom/5;
pDC->SetViewportExt( viewPortExtX, viewPortExtY);
POINT point;
point.x=winExtX;
point.y=winExtY;
pDC->LPtoDP( &point);
int viewPortOrgX=(client.right/2)-(point.x/2);
int viewPortOrgY=(client.bottom-client.bottom/5);
pDC->SetViewportOrgEx( viewPortOrgX, viewPortOrgY);
pDC->BeginPath();
pDC->MoveToEx( 0, 0);
pDC->LineTo( 0, 1500);
pDC->LineTo( 1000, 1500);
pDC->LineTo( 1000, 0);
pDC->LineTo( 0, 0);
pDC->CloseFigure();
pDC->EndPath();
CRgn Rgn;
Rgn.CreateFromPath( pDC );
RECT RgnRect;
Rgn.GetRgnBox( &RgnRect);
Rgn.DeleteObject();
}
|
|
|
|
|
hello am very interested in programing in visual c++ but am a bit confuse
can you give me so help.... especiall on functoins and classes
if you got an thn on visual C++ could you send me the link or send me a copy of yoour tutorials
please
cause i really neeed it
my email is clivestewart@hotmail.com
S.C
|
|
|
|
|
I think you'll find that everyone's tutorials are here, by default. What is confusing you ? At this point I'd urge you not to even consider writing any windows programs - if you're at a stage of understanding classes you need to be writing console programs in order to learn these basics.
A class is defined like this:
class MyClass
{
}
and can contain public, private and protected members. A member can be a variable or a function, so you might have this:
class MyClass
{
public:
int GetValue();
void SetValue(int val);
private:
int m_Value;
}
This is in your header file, the actual functions go into your cpp file like this:
int MyClass::GetValue()
{
return m_Value;
}
void MyClass::SetValue(int val)
{
m_Value = val;
}
The example is a little contrived, but I really have no idea where your area of difficulty is. Please ellucidate, on a new thread where it belongs, and I'm sure that others as well as myself would be glad to help.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I have a dialog based app that docks to the edge of the screen and auto-hides itself like the taskbar and I need to be able to tell when the mouse cursor hits the edge of the screen so I can restore my dialog. I've looked on MSDN but couldn't really find anything great, I know I can hack it and leave a corner of the dialog out and then show when the mouse enters (WM_MOUSEMOVE) but that isn't really what I want. Any help is greatly appreciated.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
I believe you're looking for
GetMouseMovePointsEx and GetLastInputInfo
These are the key API calls that you will need; and of course, you'll need knowledge of the screen size using GetSystemMetrics.
CodeGuy
http://groups.yahoo.com/group/wtl
|
|
|
|
|
Yeah, I've seen those functions but I need to continually monitor the mouse while my program is running, would that require another thread that only watches the mouse movements and what function would be a good place for these functions? Thanks for your response.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|