|
memcpy(destination, source, length);
Maxwell Chen
|
|
|
|
|
As per your advise i changed my code like this; still i am not able to see my string which i sent from application.
//ActiveX control code
void VRMControl::SendBy(BYTE* ByteValue, LONG Length)
{
BYTE val[3];
ZeroMemory (val,3);
memcpy (val,ByteValue,3);
AfxMessageBox (CString(val));
}
It says "Object Reference Error". Please provide me solution. In my first post i did mention my ActiveX calling code also please look over that too since i might donce some mistakes there.
Thanks..
|
|
|
|
|
sivaprakashshanmugam wrote: //ActiveX control code
void VRMControl::SendBy(BYTE* ByteValue, LONG Length)
{
BYTE val[3];
ZeroMemory (val,3);
memcpy (val,ByteValue,3);
AfxMessageBox (CString(val));
}
void VRMControl::SendBy(BYTE* ByteValue, LONG Length)<br />
{<br />
BYTE val[3];<br />
memcpy (val,ByteValue,3); <br />
AfxMessageBox (CString(val)); <br />
}
Maxwell Chen
|
|
|
|
|
Whats wrong with the following, actually my VC++ application is not calling ActiveX method it says "Object Reference Error", i can able to compile successfully.
brFileContent->Read (abData,0,2); //brFileContent is Binary Reader
Byte *pbManagedData = &(abData[0]); // Get starting point of Array (I can able to see Data and address here
axSimpleAdditionAtx1 ->FinalBy (pbManagedData); // Calling Activex
Method signature in ActiveX which is not getting called..
void VRMControl::SendBy(BYTE* ByteValue, LONG Length)
{
}
|
|
|
|
|
sivaprakashshanmugam wrote: axSimpleAdditionAtx1 ->FinalBy (pbManagedData); // Calling Activex
Shouldn't it be as ... below (the dot) ?
axSimpleAdditionAtx1.FinalBy (pbManagedData); // Calling Activex
Maxwell Chen
|
|
|
|
|
No it should be pointer i can able to call some other methodes, this alone is giving thie error seems there is some signature or data mismatching that i am not able to find out please help me out.
|
|
|
|
|
sivaprakashshanmugam wrote: this alone is giving thie error seems there is some signature or data mismatching
Can you give the prototype of FinalBy of ActiveX control your trying to use?
Maxwell Chen
|
|
|
|
|
This is the prototype which i am using in ActiveX
void VRMControl::FinalBy(BYTE* FinalStr)
{
AfxMessageBox ("Called..");
}
Even the message "Called.." is not displayed before that itself it throws error.
|
|
|
|
|
sivaprakashshanmugam wrote: Even the message "Called.." is not displayed before that itself it throws error.
Then it should be other reason about the initialization of that ActiveX instead of invoking the method FinalBy(...).
Maxwell Chen
|
|
|
|
|
hi
is there any way to read the SMBIOS information?
that means i want to read that low level physical memory
where SMBIOS information are stored.please help me,its
urgent.
thanx
nirmal
|
|
|
|
|
|
i need some code, that will help me.
can anybody help me please.
thanx
nirmal
|
|
|
|
|
Hi,
I have variable FName & Str,
CString FName;
char str[100];
i want the FName to be stored in str i tryed using
str = FName;
i am getting error
error C2440: '=' : cannot convert from 'class CString' to 'char [100]'
Can anyone help me with this convershion or any related notes or links will be helpfull.
Regards,
Vinay Charan.
|
|
|
|
|
Some alternatives:
strcpy(str, (LPCTSTR) FName);
strcpy(str, FName.GetBuffer(0));
OR:
char * pStr = (LPCTSTR) FName;
-- modified at 1:52 Tuesday 23rd May, 2006
|
|
|
|
|
Vinay wrote:
Hi,I have variable FName & Str,
CString FName;
char str[100];
i want the FName to be stored in str i tryed using
str = FName;
i am getting error
error C2440: '=' : cannot convert from 'class CString' to 'char [100]'
Can anyone help me with this convershion or any related notes or links will be helpfull.
See the following code
strcpy(str,FName.GetBuffer(0));
FName.ReleaseBuffer();
Hope this helps you
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi Laxman,
Do u remember yesterday i had asked u for changing the file path
C:\folder\folder\file.ext
to
c:/folder/folder/file.ext
now i have written a small program in which will change the input and get the output as
c:/folder/folder/file.ext
now i am facing one more problem file is not opening
ShellExecute(NULL, "open", str,NULL, NULL, SW_SHOWNORMAL)
is this the correct way to open the file is the code correct...
str is of char array
char str[100];
|
|
|
|
|
Can you show me the code how you changed the string path?
May be there was any bug i think code is correct.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi Laxman,
below code changes c:\folder\folder\file1.txt
to
c:/folder/folder/file1.txt
void CSearchDlg::OnDblclkSout()
{
// TODO: Add your control notification handler code here
// Code to open the selected file.
int d;
d=m_SOUT.GetCurSel();
CString FName;
m_SOUT.GetText(d,FName);
char str[100];
int i,l,k,j,m;
strcpy(str, FName);
for (i=0;str[i]!='\0';i++)
{
if (str[i]=='\\')
{
l=i; k=0;
char str1[100];
if (str[l+1]=='\0')
{
str[l]='/';
}
else
{
for (j=l+1;str[j]!='\0';j++)
{
str1[k]=str[j];
k++;
}
str1[k]='\0';
str[l]='/';
for (m=0;str1[m]!='\0';m++)
{
str[++l]=str1[m];
}
}
str[++l]='\0';
i=i++;
}
}
m_ctrlEDIT.SetWindowText(str);
ShellExecute(NULL, "open", str ,NULL, NULL, SW_SHOWNORMAL);
}
|
|
|
|
|
Try the following code as its tested and works fine.
CString str;
m_SOUT.GetText(m_SOUT.GetCurSel(),str);
ShellExecute(m_hWnd,NULL,str, NULL, NULL, SW_SHOWNORMAL);
m_ctrlEDIT.SetWindowText(str);
Hope this solve your problem.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi Laxman,
I tryed the above code it has no effect ..file does not open
m_ctrlEDIT.SetWindowText(str);
i have used this statment to just to check the value of str
str was value was like
C:\Box01/00000304/00000034.txt
as u said it cant open \ right ???
|
|
|
|
|
vinaycool wrote: C:\Box01/00000304/00000034.txt
How this is possible?
Your path in list box should be either
C:/Box01/00000304/00000034.txt
or
C:\Box01\00000304\00000034.txt
i think you are not inserting the data into list box correctly..
have you?
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi,
In the list box items are like
C:\Box01/00000304/00000034.txt
C:\Box01/00000304/00000035.txt
C:\Box01/00000304/00000036.txt
but after the function i get the value in the str as
C:/Box01/00000304/00000034.txt
since the path is correct with file name it should open right ??
|
|
|
|
|
vinaycool wrote:
In the list box items are like
C:\Box01/00000304/00000034.txt
C:\Box01/00000304/00000035.txt
C:\Box01/00000304/00000036.txt
but after the function i get the value in the str as
C:/Box01/00000304/00000034.txt
since the path is correct with file name it should open right ??
Can you post the block for insertion of the data into list box ?
and Do you want to open only .txt files?
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi,
code for inseting file names to list box & i have open only txt files only.
void CSearchDlg :: disp ()
{
int i = 0;
while (strlen (shWord[i].file_name) > 1)
{
m_SOUT.AddString(shWord[i].file_name);
int k = 0;
TCHAR buff[100];
strcpy(buff,"\0");
while (shWord[i].w_offset[k] != -1)
{
TCHAR buffer[50];
int f=shWord[i].w_offset[k];
_itoa(f,buffer,10);
strcat(buff,buffer);
strcat(buff,",");
k++;
}
buff[strlen(buff)-1]='\0';
m_SOUT.AddString(buff);
i++;
}
}
|
|
|
|
|
while (shWord[i].w_offset[k] != -1)
{
TCHAR buffer[50];
int f=shWord[i].w_offset[k];
_itoa(f,buffer,10);
strcat(buff,buffer);
strcat(buff,",");
k++;
} try this:
while (shWord[i].w_offset[k] != -1)
{
sprintf(buff,"%s%d,",buff,shWord[i].w_offset[k]);
k++;
} vinaycool wrote: m_SOUT.AddString(shWord[i].file_name);
what is datatype of file_name?
Knock out 't' from can't,
You can if you think you can
|
|
|
|