|
this is header file
#pragma once
#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<cstring>
using namespace System;
namespace Parse_J1939
{
public ref class J1939
{
public:
void function_1939();
void protocol1939(int);
};
}
====================================================
#define _CRT_SECURE_NO_DEPRECATE
#include "stdafx.h"
#include "Parse_J1939.h"
#include
#include
#include
'#using
int a=0,b=0,c=0,d=0;
char line[128],copyofline[128];
int size = 63;
char address[12]={0};
char data_1939[5]={0};
char name_1939[5]={0};
//====================================================================================
void Parse_J1939:: J1939 :: function_1939()
{
int cnt = 63;
long command_in_int;
char *lineptr,*ptrtoline,*endptr;
char *ptr_for_strtol;
FILE *ptrtofile,*ptrtowritefile;
J1939 obj;
char command[]=" ";
char pduf[] = " ";
char destination[] = " ";
char source[] = " ";
const char str[2] = " ";
lineptr = &line[0];
ptrtowritefile = fopen("H:\\write.txt","w");
ptrtofile = fopen("H:\\source.txt","r");
fgets(line,cnt,ptrtofile);
strcat(line,"\n");
fputs(line,ptrtowritefile);
fgets(line,cnt,ptrtofile);
strcat(line,"\n");
fputs(line,ptrtowritefile);
fgets(line,cnt,ptrtofile);
strcpy(copyofline,line);
ptrtoline = strtok(lineptr,str);
|
|
|
|
|
if i remember well, BSTR is the correct type when dealing with VB codes
|
|
|
|
|
can u tell mi syntax..
or
tell me search topic so that i can search on it
|
|
|
|
|
can u tell the syntax
tell me
can i convert string (in vb ) to BSTR in vc++?
|
|
|
|
|
|
|
hi
i watching ur first link
its perfect 1
i hve question
should i add any header file for BSTR?
|
|
|
|
|
hi
i watching ur first link
its perfect 1
i hve question
should i add any header file for BSTR?
thanks
|
|
|
|
|
dalbhide bipin wrote: should i add any header file for BSTR?
Only if you want to be able to use a BSTR . Why would you unnecessarily add a header file?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi All
How can I change the tab order of controls in a dialog box programmatically ?
thanks
Simon
|
|
|
|
|
Its possible with SetWindowPos but why he wants maybe he inserts dynamicaly controls
|
|
|
|
|
Use SetWindowPos() for this.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Use SetWindowPos like this[^]
|
|
|
|
|
Check this
GetDlgItem(IDC_BUTTON1)->SetWindowPos(GetDlgItem(IDOK),
0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
|
|
|
|
|
I need to retrieve the Mac Address from the network interface and I'm trying to use GetAdaptersAddress to do the same. The problem I'm having is how to call the PhysicalAddress member.
The following is the snippet of the code, I have used for definition and initialization of _IP_ADAPTER_ADDRESSES and GetAdaptersAddresses method.
PIP_ADAPTER_ADDRESSES pAdapterAddInfo;
PIP_ADAPTER_ADDRESSES pAdapterAdd=NULL;
DWORD dwretval_mac=0;
pAdapterAddInfo=(IP_ADAPTER_ADDRESSES *)malloc( sizeof(IP_ADAPTER_ADDRESSES));
ULONG ulOutBufLen1= sizeof(IP_ADAPTER_ADDRESSES);
if (GetAdaptersAddresses(AF_INET,0,NULL,pAdapterAddInfo,&ulOutBufLen1) == ERROR_BUFFER_OVERFLOW)
{
HeapAlloc(GetProcessHeap(), 0,sizeof(IP_ADAPTER_ADDRESSES));
pAdapterAddInfo = (IP_ADAPTER_ADDRESSES*) malloc(ulOutBufLen1);
}
if(dwretval_mac=GetAdaptersAddresses(AF_INET,0,NULL,pAdapterAddInfo, &ulOutBufLen1)== NO_ERROR)
{
pAdapterAdd=pAdapterAddInfo;
DWORD AddLen=pAdapterAdd->PhysicalAddressLength;
}
From here my problems start, If I look at the structure PhysicalAddress is declared as a type of BYTE.
How can I retrieve the value and store it in a String Variable.
All help and inputs will be highly appreciated.
TIA
Sreekanth
P.S : I'm an infant in the world of programming.
|
|
|
|
|
Just use WMI (Windows Management Instrumentation) to retrieve hardware stuff.
class name = "Win32_NetworkAdapter"
property name = "MACAddress"
|
|
|
|
|
How about:
for (int x = 0; x < pAdapterAdd->PhysicalAddressLength; x++)
TRACE("%02X:", pAdapterAdd->PhysicalAddress[x]);
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
What are the issues I need to be careful about here?
I have a simple MFC app wizard dialog that allows users to browse for various data files, data is then loaded into various controls and items on the dialog. When a set of manual data is entered and an add data button is clicked, I want another dialog to open up - it needs to have brought some data with it from the first dialog as it's supposed to find the closest matching data point in the original dialog and offer that as a suggestion in the 2nd dialog, the user can then accept that (in which case the 2nd dialog closes, and the suggested data is added to the controls on the main dialog), or cancel it (nothing happens in main dialog as 2nd dialog closes), or by selecting a different option in a listbox (populated by options determined by whats in the main dialog), the user can OK to close the 2nd dialog and have the data placed in the appropriate section of the controls.
I believe I just set up my 2nd dialog and then have a Domodal call to open it and test for its return code, but are there any tricks/traps I need to be aware of, and whats the "best" way to handle the data between the two - as separate dialogs, I can't for example include an array or class within the main dialog can I? do i need to use global data or is there a better way to pass/share info between dialogs
t.i.a
|
|
|
|
|
You can create your dialog and when you need to it on other dialog use of ShowWindow(SW_SHOW/SW_HIDE) .If you want to use of value or controls in other dialog you can use
CMain *m_Main=(CMain*)GetParent();
m_Main->variable or values
|
|
|
|
|
you can put the fields in the "child" dialog.
doing this, you populate their default value when constructing the dialog object (before displying it) through the constructor for instance.
then, the child dialog modifies the fields and exits.
what you have to do is checking if the Ok button was pressed (instead of Cancel, in the case of a OKCANCEL dialog) and then read the fields modified in the child dialog object ; for this, i advise you writting accessors (get methods) rather than letting the fields public
|
|
|
|
|
First, pack your data in a class
class CMyData
{
int m_iInt;
CString m_strString;
}
Put a copy constructor and an = operator for your class.
Then have an instance in your CMainDlg (say CMyData m_MainData )
In your CChildDlg, have another instance (say CMyData m_ChildData )
So in your handler,
CMainDlg::GetNewData()
{
CChildDlg cd();
cd.CopyData(m_MainData)
_OR_
CChildDlg cd(m_MainData)
_OR_
CChildDlg cd();
cd.m_ChildData = m_MainData
if (ID_CANCEL!=cd.DoModal())
{
m_MainData = cd.m_ChildData
}
}
You will need the copy operation anyway, so better put it in the <code>CMyData</code> class.
What you must not do is get a pointer on the data in the main dlg from within the child dlg and modify the data directly, because you will not know if the user cancels the operation, so you need a buffer (in our case, m_ChildDat a)
Company policy : no access to the internet but CP
~RaGE()
|
|
|
|
|
I know this is a simple question that I will regret answering. I am currently working in Borland C++ Builder (VCL) on adding some serial port activity to an older Windows project. No .NET (just yet). Rather than character by character processing messages (NMEA) from a number of serial ports I would like something simple like 'Readline' in .NET2 or an 'fgets'. Reading to a '\n' and timeout. I have done a bit of searching and found a lot of read character by character examples. Does anyone have the magic line at hand of code or recall how to read a text line?
|
|
|
|
|
jrgrobinson wrote: Rather than character by character processing messages (NMEA) from a number of serial ports I would like something simple like 'Readline'
With the ordinary serial port driver you simply cannot do this. Each character is transmitted as a groupd of bits consisting of a start bit, the actual character value, parity bits and one or two stop bits. There's no way for the hardware to know how you want to separate messages from each other; it should not since it's the wrong OSI layer for that.
It is for an application to handle this kind of situations, or some kind of service or "daemon".
I suggest that you implement a worker thread that reads the port, assembles the NMEA messages and puts them into a queue. When a complete new message has arrived and has been put in the queue, the worker thread signals the main thread to inform that there is a new message in the queue.
In your worker thread you have to read byte-wise and each NMEA message will start with '$' and end with '\n', if I remember correctly.
This way you won't bother the main thread until there's a complete NMEA message in the queue.
Have a look at Joe Newcomer's article about serial port programming here[^]. I don't know if the article is applicable for Borland C++ Builder, but it addresses some issues that you probably should think of anyway.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
Thanks Roger. It does seem like the standard exhaustive read is my more intelligent option. I have been looking at some of the old MSDN (Allen Denver, Serial Communications in Win32, 1995) and there is an EV_RXFLAG which happens in response to an event character you can set in the DCB. That does mean Overlapped receiving though which is too much for this really simple task. I was hoping I could achieve that 'One-line' as .NET2 does with ReadLine. Makes for very simple code. Thanks again for your time in responding.
|
|
|
|
|
Hello,
How I can set active tab in IE7 ? I have BHO, so i know Handles of IE main window(s) and
all Internet Explorer_Server window(s).
For example, I run 2 Internet Explorers with 3 tabs inside each.
How can i set tab #2 inside IE #1 active (e.g. visible, selected, focused) ?
Thanx for help !
|
|
|
|