|
and use LockWindowUpdate() on the control window first to stop the redraw being visible ... no?
|
|
|
|
|
hello,
I would grately appriciate an answer to the following
question, since ive tried to solve it myself for a long
time, with no effective results.
Im developing in VC++ (MFC), under WIN 95 OS.
Im trying to place in a CScrollView derived class, a large image (*.jpg, OR *.gif, OR *.bmp ) and zoom into it till 1000%. This is successful until 420%, but beyond that the program gets thrown out, and even harms other running applications.
I tried to use the methods "DrawDibDraw" and also "StretchDIBits", but was still unsuccessful.
I would greatly appreciate any help in this matter.
|
|
|
|
|
Most likely you are running out of memory when stretching the bitmap. Only draw the portion of the window that will be shown.
|
|
|
|
|
Depending on how large the bitmap is, you may be running into the 16 bit limitations of the Windows 95 GDI. This means your maximum number of pixels is limited to 32,000 pixels.
|
|
|
|
|
GDI and drivers just have lots of limitations you have to avoid. For example, they are basically 16-bit on Windows 95/98/Me, so any coordinate about 32767 would be troublesome.
For your problem, divide the bitmap into smaller pieces, or do multi-stage zommin using a memory DC.
|
|
|
|
|
How can I create the main window from a resource, instead of writing CreateWindowEx?
Thanks.
Erik
|
|
|
|
|
Unless your window is a dialog, you can't. Well, at least not easily (it would require reading the dialog resource template and creating all the windows and buttons based on that in your own code).
|
|
|
|
|
Hi all,
I created a OCX using MFC Activex Control Wizard. I also add a dialog
resource to my project. My dialog class name is CMyDialog. COleControl
drived class is CMyOCXCtrl. I created a pointer of the CMyDialog in
CMyOCXCtrl class (m_pDialog). From the OnCreate() function of CMyOCXCtrl
class, I create the dialog box ..see following code...
int CMyOCXCtrl ::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
m_pDialog = new CMyDialog(this);
if (!m_pDialog->Create( IDD_ADPWINDOW, this))
{
delete m_pDialog;
m_pDialog = NULL;
return 0;
}
m_pDialog->ShowWindow(SW_SHOW);
return 0;
}
After all of this process, I inserted the OCX in a VB form. It is working
smoothly.. but my problem is that, I cant switch focus to buttons by Tab
Key..
Tab key is not working.... Any comments are welcom.....
Thanks in advance,
Regards,
Kareem.
|
|
|
|
|
Check MSDN
PRB: Modeless Dialog Box in a DLL Does Not Process TAB Key
ID: Q233263
Igor
|
|
|
|
|
Thanks for your reply....It is working !!!!!....
Regards,
Kareem.
|
|
|
|
|
I want to know (get) ICommandWithParameters implementation code of a oledb data provider.
Where can I get it ??
(I got the some codes
-->(ex) ICommandWithParametersImpl.h file in SimpleDataObject project at this site ; .
but it is very simple.
so I can't refer it.
)
help me.....
|
|
|
|
|
I've posted this question on other sites/BBSs w/o success...
So I'm trying to write custom new and delete functions, in order to find a bunch of memory leaks in a program I'm working on. (This is in MSVC 6.) My new function I've defined as follows:
void *__cdecl operator new(size_t, debug_class);
I invoke it with
char* ptr = new (debug_class()) char[10];
my custom routine then storing appropriate info. This works fine. But for this to work correctly, I need to have a matching delete routine. I've tried something similar, defining it as so:
void __cdecl operator delete(void*, debug_class);
But how do I invoke it? I've tried several possibilities, to whit
delete (debug_class()) ptr[];
delete (debug_class(), ptr);
delete (ptr, debug_class());
etc., but mainly end up with compiler errors. The last example compiles fine, but calls the default delete operator nonetheless. Any ideas how I'd invoke it? TIA
Walter Gildersleeve
IVU-Umwelt GmbH
Freiburg, Germany
|
|
|
|
|
In a his discussion of the placement new operations Stroustrup ($10.4.11) describes a deletion mechanism using a Destroy fn which:
1. Calls the destructor of the object explicitly.
2. Frees the memory associated with it (in this case calling free(), since the operator new called alloc).
delete is not used.
On another tack, note also that the array version of delete cannot be overridden by one at class scope:
From "The operator delete Function" (MSDN):
"There are global and class-scoped operator delete functions. Only one operator delete function can be defined for a given class; if defined, it hides the global operator delete function. The global operator delete function is always called for arrays of any type"
You can, I think, overload a global operator delete[] if arrays are the problem, but this is not somewhere I have visited.
The _crtBreakAlloc mechanism is a great way to track leaks, but it's ease of use is lessened if your allocations are not predictable.
Sounds like a fun class - might be interesting to see more of the layout.
Refs:
[Stroustrup] The C++ Programming Language, 3rd Edition, 1977, Addison Wesley
|
|
|
|
|
Here's a generic test, for discussion purposes...
#include <stdio.h>
#include <malloc.h>
struct test{
int a;
int b;
int c;
void * operator new(size_t);
void operator delete(void*);
void * operator new[] (size_t);
void operator delete[] (void*);
};
void * test::operator new(size_t sz)
{
return malloc(sz);
}
void __cdecl test::operator delete(void* t)
{
free(t);
}
void * test::operator new[](size_t sz)
{
return malloc(sz);
}
void test::operator delete[](void* t)
{
free(t);
}
int main(int argc, char* argv[])
{
printf("Hello World!\n");
test* t = new test;
delete t;
t = new test[20];
delete []t;
int * p = new int;
delete p;
return 0;
}
This works as 'expected' on both Borland CPP Builder 4 and MS VC6, but leaves me with another question - I didn't expect to be able to provide an operator delete[] at class scope! Interestingly, if I try to scope the new and delete of the test class (e.g. test::new), I get errors - Borland simply gives 'Expression syntax', whereas VC6 says 'operator xxx must be globally qualified'.
What gives?
|
|
|
|
|
Hello,
this is a repost as noone could/would answer my question
So here it goes again:
Can anyone tell me how to access a vc++ 6 function from vb 6 with maybe some example code or a good website ?
I looked through deja.com but found nothing good.
I am a newbie to the component stuff.
Thanx a lot.
|
|
|
|
|
Hi,
I think an easy way is to put the "C++" function into a
DLL and export it from there. Then link the DLL to the VB
program and import the function.
Best Regards
Holger
|
|
|
|
|
There is a Micosoft System Journal article that talks about this very thing. I tried the example code and it worked. I also wrote a few DLL with Visual C++ (following the steps in the article) and they worked fine with Visual Basic.
You can find the article at:
http://www.asia.microsoft.com/msj/defaulttop.asp?page=/msj/0498/inthisissuefeatures0498.htm
gl
Jonathan Craig
|
|
|
|
|
Hi,
I would like to get the TZI key value for a Timezone in the registry so that I can tell when the Daylight Savings Time and Standard Time start.
I'm using RegQueryValueEx to get the value. It returns the size correctly but I've no idea how to parse the DWORD returned to get the date information.
DWORD size = sizeof(DWORD), type = 0, data;
LONG res = RegQueryValueEx(hKey, valueName, NULL, &type, (BYTE*)&data, &size);
TIA
Lynda
|
|
|
|
|
Hi,
Why do not use the API function "GetTimeZoneInformation".
I think it's much easier to handle.
Best Regards
Holger
|
|
|
|
|
It's not the current timezone that I need the information about. It's all the other ones listed in the registry.
Regards,
Lynda
|
|
|
|
|
Is there a quick method to make a label in a dialog a hyperlink to a webpage? (say, invoke the browser, and load the URL).
Thanks all.
|
|
|
|
|
See this URL
http://codeguru.earthweb.com/controls/hyperlink.shtml
or You can create new class, derived from CStatic.
OlegO
|
|
|
|
|
Hello,
My mainframe has a dialog-bar with four buttons. When i press a button, it becomes selected as usual. T.i. it gets a black border and a dashed focus-border. But when i press another button, only the focus-border disappears from the first one. The black selection border stays. So, after pressing all four buttons, they all have an ugly black selection border. Any ideas on how to get rid of those borders? Are those borders a style or a state?
Thanks!
|
|
|
|
|
Hi,
I fixed the problem myself eventually.
It seems that the buttons get the BS_DEFPUSHBUTTON (default button) style after pressing them. Don't ask me why.
So, after pressing a button, i reset the style back to non-default pushbutton.
style = button->GetButtonStyle();
style &= ~BS_DEFPUSHBUTTON;
button->SetButtonStyle(style);
That works.
|
|
|
|
|
has anyone else discovered a bug in the tree control when usuing unicode such that a redraw causes a memory leak and a crash ... after DeleteAllItems() is called it seems that some internal memory allocations are not handled properly ... after 4 days of mussing around i resorted to completely destroying the control and re-creating it every time it needs to be redrawn ... that worked
weird i thought ... then i remembered that windows itself is just a bunch of code written by a bunch of programmers too so it could have errors
any clues would settle a question in my head at least
thanks
|
|
|
|