|
don't know if this will work in VC++ 7, but in VC++6 it does:
you can just modify and save the header file... (it's fastest than deleting the *.clw)
hope this helps...
|
|
|
|
|
I'm using ::TextOut() to render text to a printer DC, and on most printers, this works fine, but I don't know where the font information is coming from! This is fine in most cases (by dumb luck), but on some printers the chosen font is Wingdings!
So my Q: How do I set the font for TextOut() ??
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
From MSDN: The TextOut function writes a character string at the specified location, using the currently selected font, background color, and text color.
So all you've to do is calling SelectObject, passing a handle to a former created font object.
|
|
|
|
|
ahh... ic
thx!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
This is more of a design question. I have a CDialog derived window (several) and when I spawn them I push_back their pointers on a vector. This vector is externed so the CDialog guys can see it. Now when I right click on any one of these windows I need to get the pointer of the CDialog I had stored on the vector. How do I get this to happen? Alos when i right click on this control, I want a context menu (popupmenu) to materialize.
What is the difference between the handler written to capture WM_CONTEXTMENU and WM_RBUTTONDOWN - both operate on a right mouse click.....so if I write handlers for both messages which one runs?
Appreciate your help,
ns
|
|
|
|
|
I wrote a CDialogManager class for this very purpose. (I don't have an article yet though.) Basically, what I do is put the vector of dialogs in their own wrapper class (CDialogManager in my case), and set up public methods to get at what I want. Then in your dialog that you want to access one of the ones in the vector, you merely do something like:
CMyDialog* pDialog = &MyManagerClass.GetDialog(iDialog);
Now, pDialog-> is ready to go.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
So when I am right clicking the dialog, how does it know what the iDialog is to call GetDialog with? AM I missing something really obvious?
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
What is the difference between WM_CONTEXTMENU and WM_RBUTTONDO
WM_RBUTTONDOWN is specifically for a mouse button click. WM_CONTEXTMENU is sent for a right-click, Shift+F10 keypress, or App key keypress (basically, any of the ways to get a context menu).
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
hi,
how to use CStdioFile to read separate lines from file like ifstream?
|
|
|
|
|
why do i get this message wenn i do this:
shutdown(sock, SD_BOTH);
my includes are:
#include "stdafx.h"
#include "stdio.h"
#include "tchar.h"
#include "process.h"
#include "crtdbg.h"
|
|
|
|
|
hello
you can try
"#include winsock2.h"
i hope that help you
|
|
|
|
|
lol,
thnx
|
|
|
|
|
I think you need to link with ws2_32.lib
You may need winsock2.h also, but I'm not sure.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Maybe #include winsock2.h will do the trick?
There is shutdown declared, according to MSDN.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
This is oddly missing from winsock.h , use this instead:
shutdown(sock, 2);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You past the wrong parameter to shutdown().
shutdown(theSocket, SB_BOTH);
Kuphryn
|
|
|
|
|
Hello,
I am posting here, because although the Problem refers XML, DOM and the MSXML2 Parser, i am using C++ to access the COM functions of the Parser.
After searching for simmilar thread - posts I finally did not find a solution for my problem ... although the topic was still discussed.
Is there any possibility to convert an IXMLDOMNodePtr into a IXMLDOMElementPtr ???
I know the IXMLDOMElement Object extends the IXMLDOMNode one. But because of the fact that I use the smart - pointers to the Interface Objects a downcast does not function. ( i think it is because of this )
All I want to do is just to call the IXMLDOMElement's method
' GetElementsByTagName("...") ' which unfortunatelly returns a List of Nodes ( IXMLDOMNodeList ) and not of Elements. After iterating the List a want to convert every Node of it an a IXMLDOMElement ...
Any Idea ???
Thank you in advance
VLAD
|
|
|
|
|
Does anybody know how to change a project from MFC - dynamically linked to statically linked? I'm in need of this change!
Thanks a lot.
-- narada
|
|
|
|
|
Solved!
It is changed in the project settings!
Thanks
-- narada
|
|
|
|
|
Select settings from project menu. In opened dialog from General Tab, In Microsoft Foundation Class, select "Use MFC in Statically Library".
A. Riazi
|
|
|
|
|
Thanks a whole lot!
-- narada
|
|
|
|
|
Any ideas about an app that can detect if connected to the intertet???
I wrote a function that does it well, but I want to build a process that runs at background, and every time that I connect to the internet, it will signal me somehow.
Should I use some kind of a timer that checks connection every 'x' seconds, or there is some global object (HANDLE) that I can use a wait function on it?
Any suggestion will be blessed!
--BlackSmith--
/*The roof is on fire, we don't need no water, let the MF burn*/. BHG.
|
|
|
|
|
If you're only interested in connections established by use of RAS, then the RasConnectionNotification will work. It provides you a handle to an event object to be used in any wait function.
|
|
|
|
|
I have a program in VB and this ok but the program in C++ is not ok
Can anybody help me to find the error or translate the VB to C++.
Visual Basiv program and this is OK!
///////////////////////////////////////////////
Private Sub Command1_Click()
Dim fins_cmnd(17) As Byte
fins_cmnd(0) = &H80 'ICF
fins_cmnd(1) = &H0 'RSV
fins_cmnd(2) = &H2 'GCT
fins_cmnd(3) = &H1 'DNA netword
fins_cmnd(4) = &H66 'DA1 node 102
fins_cmnd(5) = &H0 'DA2
fins_cmnd(6) = &H1 'SNA network
fins_cmnd(7) = &H64 'SA1 node 100
fins_cmnd(8) = &H0 'SA2
fins_cmnd(9) = &H1 'SID
fins_cmnd(10) = &H1 'MRC
fins_cmnd(11) = &H1 'SRC
fins_cmnd(12) = &H82 'Datatype
fins_cmnd(13) = &H0 'Startadresse
fins_cmnd(14) = &H64
fins_cmnd(15) = &H0
fins_cmnd(16) = &H0 'Antal ord.
fins_cmnd(17) = &H96
Dim I As Integer
Dim sMsg As String
For I = 0 To 17
sMsg = sMsg & Chr$(fins_cmnd(I))
Next
Winsock1.SendData sMsg
End Sub
Private Sub Form_Load()
With Winsock1
.Protocol = sckUDPProtocol
.LocalPort = 9600
.RemotePort = 9600
.RemoteHost = "192.168.1.102"
End With
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
Dim I As Integer
Dim Counter As Integer
Dim sResp As String
Dim stmp As String
Winsock1.GetData sData, , 2010
For I = 1 To Len(sData) Step 1
stmp = Hex(Asc(Mid$(sData, I, 1)))
While Len(stmp) < 2
stmp = "0" & stmp
Wend
sResp = sResp & stmp
Next
List1.Clear
For I = Len(sResp) - 599 To Len(sResp) Step 4
List1.AddItem "DM" & 100 + Counter & " = " & Mid$(sResp, I, 4)
Counter = Counter + 1
Next I
End Sub
//////////////////////////////////////////////
Visual C++ program and this is not ok pleas help me!!
//Miscellaneous variables
INT status;
WSADATA wsaData;
WORD wVer = MAKEWORD(1,1);
SOCKADDR_IN ws_addr;
int nError;
char szError[80];
ULONG icmd;
//Begin: Init Winsock2
status = WSAStartup(wVer,&wsaData);
if (status != NO_ERROR)
{
WSACleanup();
return;
}
//Init socket
Sock = socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP);
if(Sock < 0)
nError = WSAGetLastError();
// Fill out source socket's address information.
ws_addr.sin_family = AF_INET;
ws_addr.sin_port = htons (FINS_UDP_PORT);
ws_addr.sin_addr.s_addr = htonl (INADDR_ANY);
// Associate the source socket's address with the socket, Sock.
if (bind (Sock,
(struct sockaddr FAR *) &ws_addr,
sizeof (ws_addr)) == SOCKET_ERROR)
{
wsprintf (szError, TEXT("Binding socket failed! Error: %d"),
WSAGetLastError ());
MessageBox (szError, TEXT("Error"), MB_OK);
closesocket (Sock);
return;
}
//Disable non-blocking IO for purposes of this example.
icmd = 0;
status = ioctlsocket(Sock,FIONBIO,&icmd);
//GENERATE MEMORYAREA READ COMMAND
//(READ 150 WORDS FROM D00100.)
memset(fins_cmnd, 0, sizeof(fins_cmnd));
fins_cmnd[0]=0x80; /*ICF*/
fins_cmnd[1]=0x00; /*RSV*/
fins_cmnd[2]=0x02; /*GCT*/
fins_cmnd[3]=0x01; /*DNA*/ //network 1
fins_cmnd[4]=0x66; /*DA1*/ //node 102 /*Ethernet Unit FINS NODE NUMBER*/
fins_cmnd[5]=0x00; /*DA2*/ //unit 0
fins_cmnd[6]=0x01; /*SNA*/ //network 1
fins_cmnd[7]=0x64; /*SA1*/ //node 100 /*WS FINS NODE NUMBER*/
fins_cmnd[8]=0x00; /*SA2*/ //unit 0
fins_cmnd[9]=++sid; /*SID*/
fins_cmnd[10]=0x01; /*MRC*/ //command
fins_cmnd[11]=0x01; /*SRC*/
fins_cmnd[12]=0x82; /*VARIABLE TYPE: DM*/
fins_cmnd[13]=0x00; /*READ START ADDRESS: 100*/
fins_cmnd[14]=0x64;
fins_cmnd[15]=0x00;
fins_cmnd[16]=0x00; /*WORDS READ: 150*/
fins_cmnd[17]=0x96;
/*SEND FINS COMMAND*/
// Fill out source socket's address information.
memset(&cv_addr, 0, sizeof(cv_addr));
cv_addr.sin_family = AF_INET;
cv_addr.sin_port = htons (FINS_UDP_PORT);
cv_addr.sin_addr.s_addr = inet_addr (SERV_IP_ADDR);
sendlen = 18;
iRetVal = sendto(Sock, fins_cmnd, sendlen, 0,
(struct sockaddr FAR *)&cv_addr, sizeof(cv_addr));
///////////////////////////////////////////////////////////
|
|
|
|
|
Hello!
I have a strange problem. I have a standard SDI - FormView application. On the form I have two check boxes (which I have set to buttons), they are called IDC_AUTOMAT and IDC_MANUAL. I have used DDX to handle the events(created with ClassWizard), OnAutomat() and OnManual().
My problem is that if I have IDC_MANUEL checked and minimizes the application and then restore it. Somehow the OnAutomat is called. I can't figure out where this happens and how I avoid it?
Please help!
Below is the call stack when I set a breakpoint in OnAutomat().
CCOMSmartistView::OnAutomat() line 1264
_AfxDispatchCmdMsg(CCmdTarget * 0x00442180 {CCOMSmartistView hWnd=0x04c50a10}, unsigned int 2008, int 0, void (void)* 0x004014f6 CCOMSmartistView::OnAutomat(void), void * 0x00000000, unsigned int 12, AFX_CMDHANDLERINFO * 0x00000000) line 88
CCmdTarget::OnCmdMsg(unsigned int 2008, int 0, void * 0x00000000, AFX_CMDHANDLERINFO * 0x00000000) line 302 + 39 bytes
CView::OnCmdMsg(unsigned int 2008, int 0, void * 0x00000000, AFX_CMDHANDLERINFO * 0x00000000) line 162 + 24 bytes
CWnd::OnCommand(unsigned int 2008, long 22088222) line 2088
CWnd::OnWndMsg(unsigned int 273, unsigned int 2008, long 22088222, long * 0x0012f304) line 1597 + 28 bytes
CWnd::WindowProc(unsigned int 273, unsigned int 2008, long 22088222) line 1585 + 30 bytes
AfxCallWndProc(CWnd * 0x00442180 {CCOMSmartistView hWnd=0x04c50a10}, HWND__ * 0x04c50a10, unsigned int 273, unsigned int 2008, long 22088222) line 215 + 26 bytes
AfxWndProc(HWND__ * 0x04c50a10, unsigned int 273, unsigned int 2008, long 22088222) line 368
AfxWndProcBase(HWND__ * 0x04c50a10, unsigned int 273, unsigned int 2008, long 22088222) line 220 + 21 bytes
USER32! 77e72211()
USER32! 77e7356c()
USER32! 77e86e01()
USER32! 77e85f71()
USER32! 77e72c6a()
USER32! 77e72cf5()
CWnd::DefWindowProcA(unsigned int 7, unsigned int 80022032, long 0) line 1000 + 32 bytes
CWnd::WindowProc(unsigned int 7, unsigned int 80022032, long 0) line 1586 + 26 bytes
AfxCallWndProc(CWnd * 0x00442300 {CButton hWnd=0x01510a1e}, HWND__ * 0x01510a1e, unsigned int 7, unsigned int 80022032, long 0) line 215 + 26 bytes
AfxWndProc(HWND__ * 0x01510a1e, unsigned int 7, unsigned int 80022032, long 0) line 368
AfxWndProcBase(HWND__ * 0x01510a1e, unsigned int 7, unsigned int 80022032, long 0) line 220 + 21 bytes
USER32! 77e71303()
USER32! 77e71962()
NTDLL! 77f763ef()
CWnd::OnWndMsg(unsigned int 7, unsigned int 11405702, long 0, long * 0x0012f7bc) line 1872
CWnd::WindowProc(unsigned int 7, unsigned int 11405702, long 0) line 1585 + 30 bytes
AfxCallWndProc(CWnd * 0x00442180 {CCOMSmartistView hWnd=0x04c50a10}, HWND__ * 0x04c50a10, unsigned int 7, unsigned int 11405702, long 0) line 215 + 26 bytes
AfxWndProc(HWND__ * 0x04c50a10, unsigned int 7, unsigned int 11405702, long 0) line 368
AfxWndProcBase(HWND__ * 0x04c50a10, unsigned int 7, unsigned int 11405702, long 0) line 220 + 21 bytes
USER32! 77e71303()
USER32! 77e71962()
NTDLL! 77f763ef()
CFrameWnd::OnSetFocus(CWnd * 0x00000000 {CWnd hWnd=???}) line 1210
CWnd::OnWndMsg(unsigned int 7, unsigned int 0, long 0, long * 0x0012fa38) line 1872
CWnd::WindowProc(unsigned int 7, unsigned int 0, long 0) line 1585 + 30 bytes
AfxCallWndProc(CWnd * 0x00442700 {CMainFrame hWnd=0x00ae0986}, HWND__ * 0x00ae0986, unsigned int 7, unsigned int 0, long 0) line 215 + 26 bytes
AfxWndProc(HWND__ * 0x00ae0986, unsigned int 7, unsigned int 0, long 0) line 368
AfxWndProcBase(HWND__ * 0x00ae0986, unsigned int 7, unsigned int 0, long 0) line 220 + 21 bytes
USER32! 77e71303()
USER32! 77e71962()
NTDLL! 77f763ef()
USER32! 77e71350()
USER32! 77e72c6a()
USER32! 77e72cf5()
CWnd::DefWindowProcA(unsigned int 274, unsigned int 61728, long 0) line 1000 + 32 bytes
CWnd::Default() line 249
CWnd::OnSysCommand(unsigned int 61728, unsigned int 61728) line 418 + 15 bytes
CFrameWnd::OnSysCommand(unsigned int 61728, long 0) line 1046
CWnd::OnWndMsg(unsigned int 274, unsigned int 61728, long 0, long * 0x0012fd98) line 1849
CWnd::WindowProc(unsigned int 274, unsigned int 61728, long 0) line 1585 + 30 bytes
AfxCallWndProc(CWnd * 0x00442700 {CMainFrame hWnd=0x00ae0986}, HWND__ * 0x00ae0986, unsigned int 274, unsigned int 61728, long 0) line 215 + 26 bytes
AfxWndProc(HWND__ * 0x00ae0986, unsigned int 274, unsigned int 61728, long 0) line 368
AfxWndProcBase(HWND__ * 0x00ae0986, unsigned int 274, unsigned int 61728, long 0) line 220 + 21 bytes
Mike Eriksson
Sonork 100.21825
|
|
|
|
|