|
Hi there
Its for extreme beginners, I think. I was expecting like how do I add some more controls in it, how do I make it work, etc. The article just shows how to make one SDI app. I will be thankful if you can provide me with the required. Thanks for your time. Please note that I have a fair knowledge of working with dialog based apps.
|
|
|
|
|
oh Well I think you need to a basic article you said I need to learn SDI/MDI.Did you search on codeproject
|
|
|
|
|
Yes, I searched but there are just too many of them either with loads of information which is a little overdose for me or an article like "how to create a SDI app using the wizard". I look for something in between though
|
|
|
|
|
I want to answer to you but I think you get your answer with CFormView(David Crow) now you can insert your controls on forum.
|
|
|
|
|
Aljechin wrote: I was expecting like how do I add some more controls in it...
One way is to derive the view from CFormView .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Might I suggest a very good book (softcover) called 'Beginning MFC Programming', by Ivor Horton. This book has an excellent tutorial in it and explains things very well.
John P.
|
|
|
|
|
Hi,
I want to move a file in my system to a remote system.
For example I have a file "abc.wav" in my system . Now I want to move this file to another remote system's subdirectory(say "c://xyz").
IP of the remote system say "1.2.0.4".
Can anyone help me.
Thanks in advance.
|
|
|
|
|
use sockets for that purpose with file reading,u will find the code on code project as well just search "Network Transfer of File".
thing u had to do is read a file from computer and send to another using sockets where other side will receive and then write on file in this way the transfer will take place.
Tasleem Arif
|
|
|
|
|
you could also attach to a share on the other machine eg \\1.2.0.4\c$\xyz either programmatically or through a script to map a drive, then copy the file there using copyfile()
bit lower tech than using the socket suggestion ...
'g'
|
|
|
|
|
What about MoveFile() or SHFileOperation() ? If neither of them accepts a UNC path, you can make use NetUseAdd() to map a drive letter to the remote share.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Dear All,
How do i convert TCHAR[75] to CLSID ?
Kindly ... Help in this .
|
|
|
|
|
|
How to export MS outlook mail to a text file?
Who have source?Please email me.
My e-mail:phyton_y@163.com
thanks a lot!
|
|
|
|
|
Can you use Outlook Automation?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Do you have some source about Outlook Automation?
I know this ,but I do't know how to use it!
thanks!
|
|
|
|
|
There are tons of example available, like:
_Application app;
_NameSpace ns;
_MailItem mi;
COleVariant vtOptional((long) DISP_E_PARAMNOTFOUND, VT_ERROR),
vtTrue((short) TRUE);
long olFolderInbox((long) 6),
MAPIFolder folderInbox;
_Items itemsMessages;
if (app.CreateDispatch("Outlook.Application") == TRUE)
{
ns = app.GetNamespace("MAPI");
ns.Logon(vtOptional, vtOptional, vtTrue, vtTrue);
folderInbox = ns.GetDefaultFolder(olFolderInbox);
itemsMessages = folderInbox.GetItems();
for (int x = 0; x < itemsMessages.GetCount(); x++)
{
mi = itemsMessages.Item(COleVariant((long) x + 1L));
TRACE("Message %d, subject = %s\n", x, mi.GetSubject());
}
ns.Logoff();
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
Why should we register a window class? What is its actual advantage?
Thank you.
- NS -
|
|
|
|
|
The windows class has a lot of functionality. The most important is to tell Windows which WndProc to call when a message is send to the window. It also tells which brush to use to paint the background, which icon to show and which cursor should be displayed when the mouse is over the window. It also tells Windows which menu to associate with the window. Pretty important stuff.
Cheers
Steen.
"Are you gonna check your makeup when you're done whining?" John Simmons, 05/31/2006
|
|
|
|
|
These all are assosiated with window class. This is OK. But I would like to know the reason for such a registration.
I dont feel this is just for getting such settings. Because in many cases registered window class is used for a single program only. Some times, only for one window.
- NS -
|
|
|
|
|
Well, even if there only exist one window of any given class in the entire universe, Windows still needs to know these things. And since there may exists hundreds of windows of the same class (a static text control is a good example) you may as well put these common things into a windows class instead of defining them for each instance of the class. It's analogous to defining the member functions of a C++ class each time you declare an instance - that would not be efficient either.
The bottom line is that your Windows program won't work if you don't register your window classes. Live with it.
Cheers
Steen.
"Are you gonna check your makeup when you're done whining?" John Simmons, 05/31/2006
|
|
|
|
|
|
Thank you.
I have to look deep inside this.
- NS -
|
|
|
|
|
Don't confuse a Windows class with a C++ class. They are totally different.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
No confusion
But confusion is only in the reason for such an idea of having a class registered to create a window. I dont know the reason (that cannot be avoided) behind this idea.
- NS -
|
|
|
|
|
// File: struct-test.cpp
#include "Socket.h"
#include <iostream>
#include <process.h>
#include <sstream>
#include <fstream>
#include <string>
#include <winsock.h>
#include <winsock2.h>
#include <windows.h>
#include <cstdio>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
//TCP/IP
int open_connection(const string& hostname, int portnr) {
SOCKET mySocket = socket(AF_INET, SOCK_STREAM, 0);
cout << "errno = " << errno << endl;
cout << "socket = " << mySocket << endl;
struct sockaddr_in itsTCPAddr;
memset (&itsTCPAddr, 0, sizeof(itsTCPAddr));
itsTCPAddr.sin_family = AF_INET;
unsigned int IPbytes;
// try if hostname is hard ip address
if ((IPbytes = inet_addr(hostname.c_str())) == INADDR_NONE) {
cout << "inet_addr return INADDR_NONE" << endl;
// No, try to resolve the name
struct hostent* hostEnt; // server host entry
if (!(hostEnt = gethostbyname(hostname.c_str()))) {
cout << "Socket:Hostname (" << hostname << ") can not be resolved" << endl;
return (-2);
}
// Check type
if (hostEnt->h_addrtype != AF_INET) {
cout << "Socket:Hostname(" << hostname << ") is not of type AF_INET"<< endl;
return (-3);
}
memcpy (&IPbytes, hostEnt->h_addr, sizeof (IPbytes));
}
memcpy ((char*) &itsTCPAddr.sin_addr.s_addr, (char*) &IPbytes, sizeof(IPbytes));
itsTCPAddr.sin_port = htons(portnr);
printf ("IPbytes = %04x\n", IPbytes);
printf ("sin_addr:%x", itsTCPAddr.sin_addr);
printf ("sin_port:%d", itsTCPAddr.sin_port);
printf ("sin_fami:%d", itsTCPAddr.sin_family);
int result = connect(mySocket, (struct sockaddr *)&itsTCPAddr, sizeof(struct sockaddr_in));
cout << "connect_errno = " << errno << endl;
cout << "result = " << result << endl;
return (mySocket);
}
struct Modbus_TCP { // (14 bytes) Declare Modbus_TCP struct type
short TransactionIdentifier; // = 2 bytes
short ProtocolIdentifier; // = 2 bytes
short Length; // = 2 bytes
byte UnitIdentifier; // = 1 byte
// -modbus
byte FunctionForceMultipleCoils; //:15 = 1 bytes
short ReferenceNumber; // = 2 bytes
short BitCount; // = 2 bytes
byte ByteCount; // = 1 byte
byte Data; // = 1 byte
} Modbus_TCP_t;
int main() {
WORD wVersionRequested = MAKEWORD(1,1);
WSADATA wsaData;
int nRet;
nRet = WSAStartup(wVersionRequested, &wsaData);
if (wsaData.wVersion != wVersionRequested)
{
fprintf(stderr,"\n Wrong version\n");
return(-1);
}
int connection;
cout << "opening connection" << endl;
connection = open_connection("10.151.218.2", 502);
cout << "connection = " << connection << endl;
cout << "errno = " << errno << endl;
struct Modbus_TCP command;
command.TransactionIdentifier = htons(0);
command.ProtocolIdentifier = htons(0);
command.Length = htons(8); //moeten 4 bits zijn
command.UnitIdentifier = 01;
command.FunctionForceMultipleCoils = 15;
command.ReferenceNumber = htons(16);
command.BitCount = htons(6);
command.ByteCount = 01;
command.Data = 8;
int result = send(connection, (char*)&command, sizeof(command), 0);
cout << "sizeof(command)=" << sizeof(command) << endl;
cout << "sendresult = "<< result << endl;
return 0;
}
this is my error
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Linking...
Cpp1.exe - 0 error(s), 0 warning(s)
I have changed it (with some help) it is working now
-- modified at 3:12 Thursday 12th October, 2006
Dorbeck
|
|
|
|