|
Yes, almost all comertial programs are programmed in C/C++.
Both programs designed for Win16 (16 bits) and Win32 (32 bits) can be run under Win98. However there are uncountable reasons to use Win32 programming rather than Win16.
I don't know what compiler are you using. Weather your compiler suports Win32 or not should be ask to the compiler manufacturer. For example:
Visual C Version 1.x is designed for 16 bit programming.
Visual C 4.0 and above suports only 32 bit programming.
Borland C 4.5 suports both 16 and 32 bit programming, but it does not have debugger for 32 bit programs.
Borland C 5.0 and above are designed for 32 bit programming. I'm not sure if it also supports 16 bit programming also.
There are many other windows compilers.
|
|
|
|
|
How to execute outproc COM server from IIS extention with IIS 3
|
|
|
|
|
Hello,
I made this MFC prog (SDI) that changes the default formview to another
formview, but strangly all the controls (derived from CWnd) on this new
formview are missing their CWnd handle (m_hWnd = 0x0000000). what could be
causing this ??
thx,
Pedro Fortuna
|
|
|
|
|
Sounds like the form or its controls haven't been Create()ed yet.
Are you modifiying the CSingleDocTemplate in InitInstance with the name of your new view? If so, the framework should handle creation for you. Have you used the class wiazrd to associate the dialog resouce with that view?
|
|
|
|
|
I found that the error was on the way i switched between views... im using the example on this page http://codeguru.earthweb.com/doc_view/switching_views.shtml
|
|
|
|
|
I created a button dynamically using Cbutton::Create. How do I modify the button after it's been created or even during creation to modify the window style, for example to give the button a static edge.
Here's my code. I tried using CreateEX, with no luck. Anyone have any ideas?
CRect stButton1;
stButton1.SetRect (1080, 170, 1155, 245);
if ( !m_createSpaceTrack.Create
("BREAK
TRACK",WS_PUSHBUTTON|WS_VISIBLE|WS_CHILD|WS_TABSTOP,stButton1,this,1200) )
{
// Failed to create a control.
AfxMessageBox((LPCTSTR)"Failed to Create SPACETRACK Button1",MB_OK,0); }
|
|
|
|
|
This is probably more than you want, but hey...
void TestDialog::OnOK()
{
static int n = 0;
if(!m_cbSpaceTrack.m_hWnd) {
CRect stButton1;
stButton1.SetRect (20, 20, 140, 60);
if ( !m_cbSpaceTrack.Create("BREAKTRACK",BS_PUSHBUTTON |WS_TABSTOP|WS_VISIBLE|WS_CHILD|WS_BORDER,stButton1,this,5000) )
{
AfxMessageBox((LPCTSTR)"Failed to Create SPACETRACK Button1",MB_OK,0);
}
}
else {
m_cbSpaceTrack.ShowWindow(SW_HIDE);
switch (n) {
case 0 :
m_cbSpaceTrack.SetButtonStyle(BS_CHECKBOX, TRUE);
++n;
break;
case 1 :
m_cbSpaceTrack.SetButtonStyle(BS_GROUPBOX, TRUE);
m_cbSpaceTrack.ModifyStyle(0, WS_BORDER);
++n;
break;
case 2 :
m_cbSpaceTrack.SetButtonStyle(BS_RADIOBUTTON, TRUE);
m_cbSpaceTrack.ModifyStyle(WS_BORDER,0);
n=0;
break;
case 3 :
m_cbSpaceTrack.SetButtonStyle(BS_PUSHBUTTON, TRUE);
m_cbSpaceTrack.ModifyStyle(0, WS_BORDER);
n=0;
break;
default:
break;
}
m_cbSpaceTrack.ShowWindow(SW_SHOW);
}
}
Beyond this type of stuff, you might need to use the BS_OWNERDRAW style and override DrawItem.
|
|
|
|
|
I have written an MFC program (dialog based) to load a bitmap file, and display it on a frame control. This all works fine, except when you put another window on top of it! How do you get the bitmap to stay on the DC?
Any help would be greatly appreciated...
James Bird - birdjames@bigfoot.com
|
|
|
|
|
You need to do your drawing in OnPaint. which is called when a window is invalidated by another.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Can anyone tell me how document , view and main frame come into the whole picture of VC++?
|
|
|
|
|
Yes - and his name is Mike Blaszczak! Actually, think he has a big red book in print on this stuff...
Ok - but since 'big red book' is not too precise when dealing with librarians, and that name's a killer to spell, I guess I could venture a short answer.
The doc/view archetecture is part of the MFC, not VC++ per se. (Even Borland's compiler can compile MFC source).
Essentially, the doc/view is an avatar of a Model-View Controller (MVC). You have the blob you're working with (document), and one or more visual representations (views). The visual code (draw, scroll) is separated from the blob code (load, save). Connecting them is some sort of Udate code, and the mainframe lets you control them.
The doc/view perhaps makes more sense when you're working with files that are dealt with as a block (see serialization) - text docs, pictures and the like, as opposed to, say, databases which follow a finer grained transactional model (usually you don't load a whole database to modify it - you take the piece you need) but depending on what you call a document (yes, could even be a database connection) you can squeeze a lot of different apps into this model.
The doc view thing can also allow you to have different views of the same document (say, a hex view of a bitmap as well as wsyiwig) etc. and switch between them.
The doc/view architecture is one application framework (afx) that MFC has to offer, but certainly not all there is to MFC, which in turn is not all there is to VC.
|
|
|
|
|
Does anyone has come across screen capture source code and complied by VC++ 5 or 6 ? If so , can you send to me ?
|
|
|
|
|
Have a look around: http://codeguru.earthweb.com
I had found a working sample but I cant remember the exact location
|
|
|
|
|
I recently creating my internet explorer, but I don't know how to display the Url out(like show the url in a edit box)when my mouse moves over a link!!!
|
|
|
|
|
I have a MDI program that saves and loads grapicial data. A problem in the loading occurs and I can't figure out why.
When loading the file into the program I recieve a framed/bordered window/view that is apparently disconnected to the main frame windows client area. It appears to the lower right of the main frame. It doesn't have a menu or title bar, just the view with a border. All drawing functions work in this view.
If I resize the view in any way then the view snaps to the frame as expected or recieves the title bar if that is th type of resizing done.
I don't understand why the program hasn't processed these events fully in the file loading procedure. And after pouring through reams of data in the MSDN I still do not have a clear understanding of what I must do to cause these events to happen programmically.
Can someone enlighten me about this?
Steve P.
|
|
|
|
|
I wan't to be notified when a component of my dialog is changed and the client area redrawn because of that. As far as I can see, the only way to accomplish this is to.
a) use CWnd::OnColorCtl, which is called every time the component is redrawn, far to often for any nontrivial processing.
b) Subclass each component. Very boring.
c) Have owner-drawn controls and use CWnd::OnDrawItem. But then I'm responsible for drawing. How do I do that?
What I really want to do is manipulating the DC after the standard windows drawing is made, to accomplish fading effects and so on.
Any Ideas?
|
|
|
|
|
Why subclassing is very boring ?
Hook into EndPaint, where you can get the DC before it's released.
|
|
|
|
|
Subclassing takes a lot of time because a class have to be crated for each control type.
By hooking, do you mean make a class that inherits for example CButton and have an own EndPaint which overrides the standard one?
|
|
|
|
|
You can define a single class for subclassing all windows, each with an instance of the class. The reason is you just need to get control after WM_PAINT message is processed.
By hooking this time, I mean overwrite the code for EndPaint to point to your code.
Check this: http://www.fengyuan.com/article/wmprint.html
|
|
|
|
|
Yes, I can define a single class to subclass all windows, but not all controls. A class which subclasses CButton must inherit CButton, at least according to Visual Studio.
Overwrite the code for EndPaint surely works, but it isn't something you want to put in your application if you can avoid it. It also means changing the call for other applications.
I want to be able to access the contents of the client area as a device context or something similair when I know that all drawing is done for now. If I knew how to call a controls default drawing procedure, I could subclass all controls as a last solution and use OnDrawItem.
I don't want to create my own classes where I inherit for example CButton since I must ship those with my application, and they would be unusable with the dialog editor.
I've also notified that OnPaint isn't called for a CButton when pressed. Why not?
|
|
|
|
|
Defining a class without MFC to subclass every window, including all controls.
Why MFC ?
|
|
|
|
|
I have an MDI application. I have created an accelerator associated with the VK_DELETE key.
I would like to disable the translation of this accelerator in one type of frame window but not in others. How can i do it?
Thanks in advance,
Jose.
|
|
|
|
|
Hello people,
See this code:
#ifdef DLLTEST_EXPORTS
#define DLLTEST_API __declspec(dllexport)
#else
#define DLLTEST_API __declspec(dllimport)
#endif
//This class is exported from the dlltest.dll
class DLLTEST_API myclass {
public:
vector <myclass*> v;
myclass(void);
// TODO: add your methods here.
};
Every time I try to export classes (see example above) that use stl classes (e.g. vector) from DLL I get the following warning:
warning C4251: 'v' : class 'std::vector<class myclass="" *,class="" std::allocator<class="" ,="" *=""> >' needs to have dll-interface to be used by clients of class ',myclass'
Any Ideas to solve this?
|
|
|
|
|
I'm not sure, but it looks to me as though the problem is that your class inherits from a parameterized class without using templates. Either
template <class Ty_, class A_ = std::allocator<Ty_> > class DLLTEST_API myclass {
public:
std::vector<Ty_, A_> v;
...
};
or
class DLLTEST_API myclass {
public:
std::vector<char> v;
...
};
should work for you.
In the former case, you may also get into some trouble if you do not define specific instantiations of your generic class, since the way templates are handled in VC++ does not allow separate compilation of the bodies of template functions and class methods, so you can't hide the implementation details of generic classes in a .cpp file that goes into a DLL---the implementation must be present in the header file.
|
|
|
|
|
Read the article of Joseph M. Newcomer "Time is the Simplest Thing..." on this site: http://www.codeproject.com/system/simpletime.asp
|
|
|
|