|
I have an existing console app in which I need to get some information from the registry which is placed there by a regular Windows based MFC app.
I have tried WriteProfileString(), WriteProfileInt(), GetProfileString(), GetProfileInt(), etc. with no luck. Any suggestions? Thank You.
|
|
|
|
|
MSDN
Platform SDK
Base Services
Registry
Registry Reference
Registry Functions
Have a look at RegEnumKey/RegCreateKey and so on. There are plenty of
examples in the platform SDK. There are also examples on code project.
Stephen
|
|
|
|
|
I've had some freaky stuff going on with printing for a while. I'm hoping someone can help me out here.
I've got a bitmap (technically, I'm trying to write the whole screen) that I'm trying to write out to a
network printer. The code I'm working with does the following: Creates a screen-compatible memory
DC, then blits the screen into it. Converts that into a DIB, then calls StretchDibBits to the printer DC.
Works perfectly, under NT. When I try to run the same code under Win98, I have problems. The blit
works fine, but the stretch on the DIB returns an error. The return code indicates I have an
"invalid parameter". If I stretch first and then SetDiBits, the code works, but I lose all my color
information...
I'm completely confused. I've tried everthing I can think of to get this code running. For the moment,
I've just put in a check and a message box that indicates this feature is only available under WinNT, but
I'd like to fix it if at all possible.
Anyone have any ideas?
>>>>>>>>>> Nathan
If a picture is worth a thousand words, reproducing a bug is worth ten thousand.
|
|
|
|
|
I have a class for resize my dialog. But if I make an anchor for my activx (gantt) the variable "wnd" for the Addanchor class is empty. Why?
And wich is the state for a activx? like STATIC.......
bogdan
|
|
|
|
|
I have a class for resize my dialog. But if I make an anchor for my activx (gantt) the variable wnd is empty. Why?
bogdan
|
|
|
|
|
Hi.
I have a problem when I try to retrieve local IP address.
I insert this code into CMyDlg::InitDialog:
gethostname(buffer, 255); //buffer is a char* CMyDlg member variable HOSTENT* hEnt = gethostbyname(buffer); if ( hEnt ) { strcpy(buffer, inet_ntoa( *(LPIN_ADDR)*(hEnt->h_addr_list))); }
... but it, when links, says:
MyDlg.obj : error LNK2001: unresolved external symbol _inet_ntoa@4
MyDlg.obj : error LNK2001: unresolved external symbol _gethostbyname@4
MyDlg.obj : error LNK2001: unresolved external symbol _gethostname@8
Debug/My.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
My.exe - 4 error(s), 0 warning(s)
WHY?????????
IS THERE ANYONE WHO HELP ME???
Thanks in advance.
Of course I added in code:
#include "winsock.h"
Ing. Marco Moscato
SeaSoft S.p.A., Catania, Italia
E-mail: mmoscato@seasoft.it
|
|
|
|
|
In your project settings, try to link to wsock32.lib....
Ciaran
|
|
|
|
|
Hi,
I'm planning to realize a new project with Visual C++. It should uses ADO and other COM components.
Is it clever to still use MFC with lots of conversions and other disadvantages or should I use a new technology like ATL or WTL?
What's your opinion?
Thanks in adance
Christian
|
|
|
|
|
I found MFC a lot easier to use and works every well for all of my projects. The latest ATL may be a little better, but we do not have the luxury of upgrading to the latest version of VC++. We are still using VC++ 5.0. ATL in VC++ 5.0 is a pain in the butt for simple things such as adding an event to your com object. A lot of people here will probably tell you different things, though.
|
|
|
|
|
1. I'm looking for guidelines for creating a COM+ application using VC++ 5.0. I have knowledge of idl, ATL, VC, & COM.
Not sure on how to build this knowledge into a COM+ Application in Windows2000.
Is there any good documentation available.
2. Is MFC Dead, is it still supported?
Gerry.
|
|
|
|
|
I forget how to get the language info in Windows. :-P Thanks for any help.
|
|
|
|
|
Use MSDN.
MSDN LIbrary
Platform SDK
Base Services
Internation Features
National Language Support
National Language Support Functions
Its all described here
Its not MFC, but you don't need MFC to do this.
Stephen Kellett
|
|
|
|
|
I have a cformview w/ a control that I'd like to have respond to the enter key. I understand you can use getdlgcode for dialogs, but would I need it for this situation? How would I go about doing this? I searched around but didn't come up with much in my situation. Any leads would be appreciated.
Thanks in advance.
|
|
|
|
|
I need to solve real-time second order differencial equations. Do you know some library I can get to work it out?
Giorgetti Stefano
|
|
|
|
|
Check out http://www.maplesoft.com/
Maple is a symbolic math engine that will do what you need. I don't know if they sell the library to end-users or not. ( i know that they sell it with MATLAB...)
|
|
|
|
|
Hi
I have a function in my document class that returns a reference to a Ctypedptrlist.
I wan't to access this list(function)in my own class derived from Cobject.
I have tried to use a Getdocument function but it won't work.(how to do this?)
I can't include the document header file in my class.
If i can't access the function in my document class, then I need to make a static CList. I have tried
but I can't seem to get it working.(how to do this?)
as you probably can see (by my problems) I'm quite new to c++ and MFC, and I'm working on my
first program.
Svein Ravndal
|
|
|
|
|
Hi again,
let me tell you the information again. I have a touchscreen, touchscreen driver, and a MFC program for touchscreen. This MFC program gets data from touchscreen through driver. And driver gets info. from touchscreen through COM port (translate the hex number from COM to something else). Make sense?
Now, MFC programming is talking about events or messages. If there is no message, MFC can do nothing, right? I have to get the notification of ERROR TOUCH. However, then ERROR TOUCH happened, no message sends from Driver to message queue , and MFC keeps silent.
My question is: is there any way to get this data directly from COM port, or do you have any suggestion so that i can get the ERROR TOUCH?
Thanks.
|
|
|
|
|
Well, yes.. you can get the data directly from the COM port, but you'll have to know the format this data uses, and you'll have to disable the driver, since it will own the COM port exclusively.
COM ports act just like files, you open them as files and read from them like files. There are a few functions used to manipulate COM ports that do not apply to files though, these functions are SetCommState and SetCommTimeouts and they take the same file handle used in reading and writing to a file.
|
|
|
|
|
Do you have some sort of interface to the driver/lib that you can call at the user level that takes a window handle identifying the window to receive the messages?
You could probably pass AfxGetApp()->m_pMainWnd->m_hWnd as the handle.
Just a thought... not quite sure I understand the setup.
|
|
|
|
|
Hmmm - maybe I misunderstood - you are wondering how to trap a windows message that MFC does not recognize in the class wizard etc - i.e. not a standard windows message.
You can use the message map macros - there are several, like ON_MESSAGE, ON_COMMAND, etc. They presuppose functions with particular signatures, so read the docs on these.
For example, I have a class that changes state - and it is separate from a dialog that needs to be updated when the state changes. Instead of making the class 'know' about the dialog, I define a new message that the class can send, and handle it in the dialog by adding a handler and a message map macro.
I use the ON_MESSAGE macro here:
BEGIN_MESSAGE_MAP(COPCSim1Dlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_MESSAGE(WM_STATUSCHANGE, OnStatusChange)
END_MESSAGE_MAP()
Then define your handler according to what the macro expects - in this case:
afx_msg LRESULT OnStatusChange(WPARAM, LPARAM);
When something changes, I let the dialog know with PostMessage:
PostMessage(theApp.m_pMainWnd->m_hWnd, WM_STATUSCHANGE, 0, SESSION_CLOSED);
In your case, you'll need to read the docs I guess to figure out what macro you can use. I'm assuming that the driver puts the message in the systems raw input thread and it gets to your window without you having to subscribe to it - and it may even be a standard message with the ERROR TOUCH as one of the parameters by the time it gets to your app - again, you'll need to read the docs. But thought this might help.
For testing, you can add code to PretranslateMessage or DefWindowProc to see if the message is getting through. The macros are a bit more MFC like, and you don't need Class Wizard to use them.
|
|
|
|
|
I have a single CListCtrl object on 5 property pages (5 objects). When I minimize my app and then restore it the objects are re-displayed and refreshed as expected. Here is the problem, if I click on any single entry within the CListCtrl object (any one of the objects on any one of the propery pages) and then minimize the app, when the app is restored the CListCtrl object is not displayed. If I click on another property page and back the CListCtrl object is displayed as I expect. I am stumped.
Dedication to the job at hand.
|
|
|
|
|
Hi, i want to add a button next to the buttons at the right top corner (nex to close, minimize, maximize) and use it as "minimize to tray", like in getright.
thanks a lot!
|
|
|
|
|
subclass the mainframe window and add a function to process the button click as well as adding the button in the draw mode
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi,
1. gethostbyname() retrives the host information from host database.what is host database? Is it some file stored on local mechine? How it is giving the information? Or It will query DNS server?
If so, what is the funda behind this?
2. what is DNS server? where can i get more info?
Thanks in advance,
Koteswara Rao, Perumalla
theearth1947@yahoo.com
|
|
|
|
|
Host information can be obtained by several ways:
1) The HOSTS file on the local machine.
2) DNS server response
3) WINS server response
4) DHCP server response
The DNS WINS and DHCP servers are all configured in your local network properties.
|
|
|
|