Click here to Skip to main content
15,888,579 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Loading .PNG image windows GDI Pin
Mark Salsbery20-Mar-08 5:03
Mark Salsbery20-Mar-08 5:03 
GeneralRe: Loading .PNG image windows GDI Pin
CPallini20-Mar-08 5:27
mveCPallini20-Mar-08 5:27 
GeneralRe: Loading .PNG image windows GDI Pin
David Crow20-Mar-08 5:52
David Crow20-Mar-08 5:52 
GeneralRe: Loading .PNG image windows GDI Pin
CPallini20-Mar-08 6:33
mveCPallini20-Mar-08 6:33 
GeneralOutlookAddin related problem. Pin
ritz123420-Mar-08 2:50
ritz123420-Mar-08 2:50 
GeneralRe: OutlookAddin related problem. Pin
_AnsHUMAN_ 20-Mar-08 2:54
_AnsHUMAN_ 20-Mar-08 2:54 
GeneralRe: OutlookAddin related problem. Pin
ritz123420-Mar-08 3:05
ritz123420-Mar-08 3:05 
GeneralUsing C/C++ DLL at Visual Basic 6.0 [modified] Pin
Scmitd20-Mar-08 1:04
Scmitd20-Mar-08 1:04 
Hello,

I have big problem. About 1 week i search to find a way to convert a small C++ codes to VB 6.0. As a final i decided the best way is to make a dll from C codes to use this fubction in VB 6.0 . I searched a lot of articles but i couldn't succeed it because i don't know anything in C/C++. Somebody can help to me? Somebody can make a dll for me from this small code? Or can i convert these codes to VB 6.0 codes? If dll is possible i want to call "ComputeCrc" function from VB.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define CRC_A 1
#define CRC_B 2
#define BYTE unsigned char
unsigned short UpdateCrc(unsigned char ch, unsigned short *lpwCrc)
{
ch = (ch^(unsigned char)((*lpwCrc) & 0x00FF));
ch = (ch^(ch<<4));
*lpwCrc = (*lpwCrc >> 8)^((unsigned short)ch << 8)^((unsigned short)ch<<3)^((unsigned short)ch>>4);
return(*lpwCrc);
}
void ComputeCrc(int CRCType, char *Data, int Length,
BYTE *TransmitFirst, BYTE *TransmitSecond)
{
unsigned char chBlock;
unsigned short wCrc;
switch(CRCType) {
case CRC_A:
wCrc = 0x6363;
break;
case CRC_B:
wCrc = 0xFFFF; 
break;
default:
return;
}
do {
chBlock = *Data++;
UpdateCrc(chBlock, &wCrc);
} while (--Length);
if (CRCType == CRC_B)
wCrc = ~wCrc;
*TransmitFirst = (BYTE) (wCrc & 0xFF);
*TransmitSecond = (BYTE) ((wCrc >> 8) & 0xFF);
return;
}
BYTE BuffCRC_A[10] = {0x12, 0x34};
BYTE BuffCRC_B[10] = {0x0A, 0x12, 0x34, 0x56};
unsigned short Crc;
BYTE First, Second;
FILE *OutFd;
int i;

int main(void)
{
printf("CRC-16 reference results ISO/IEC 14443-3\n");
printf("Crc-16 G(x) = x^16 + x^12 + x^5 + 1\n\n");
printf("CRC_A of [ ");
for(i=0; i<2; i++) printf("%02X ",BuffCRC_A[i]);
ComputeCrc(CRC_A, BuffCRC_A, 2, &First, &Second);
printf("] Transmitted: %02X then %02X.\n", First, Second);
printf("CRC_B of [ ");
for(i=0; i<4; i++) printf("%02X ",BuffCRC_B[i]);
ComputeCrc(CRC_B, BuffCRC_B, 4, &First, &Second);
printf("] Transmitted: %02X then %02X.\n", First, Second);
return(0);
}
</ctype.h></string.h></stdlib.h></stdio.h>

I think i don't need int main block when i use this code as a dll. So i must give BuffCRC_A and BuffCRC_B values from VB

Thanks

Best Regards

Murat

modified on Thursday, March 20, 2008 8:48 AM

GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
CPallini20-Mar-08 1:24
mveCPallini20-Mar-08 1:24 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
Scmitd20-Mar-08 2:55
Scmitd20-Mar-08 2:55 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 [modified] Pin
CPallini20-Mar-08 5:23
mveCPallini20-Mar-08 5:23 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
David Crow20-Mar-08 3:13
David Crow20-Mar-08 3:13 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
CPallini20-Mar-08 3:19
mveCPallini20-Mar-08 3:19 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
Scmitd20-Mar-08 4:09
Scmitd20-Mar-08 4:09 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
David Crow20-Mar-08 4:11
David Crow20-Mar-08 4:11 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
Scmitd20-Mar-08 4:31
Scmitd20-Mar-08 4:31 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
David Crow20-Mar-08 4:49
David Crow20-Mar-08 4:49 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
Scmitd20-Mar-08 4:32
Scmitd20-Mar-08 4:32 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
led mike20-Mar-08 4:26
led mike20-Mar-08 4:26 
GeneralRe: Using C/C++ DLL at Visual Basic 6.0 Pin
Scmitd20-Mar-08 4:37
Scmitd20-Mar-08 4:37 
QuestionWhat i need to do in VC++ 6 to activate the creation of dump file in crash ? Pin
Yanshof20-Mar-08 0:57
Yanshof20-Mar-08 0:57 
AnswerRe: What i need to do in VC++ 6 to activate the creation of dump file in crash ? Pin
Paresh Chitte20-Mar-08 1:57
Paresh Chitte20-Mar-08 1:57 
QuestionCreateDialog Question Pin
Programm3r19-Mar-08 22:40
Programm3r19-Mar-08 22:40 
GeneralRe: CreateDialog Question Pin
Rajkumar R19-Mar-08 23:11
Rajkumar R19-Mar-08 23:11 
QuestionRe: CreateDialog Question Pin
Programm3r19-Mar-08 23:16
Programm3r19-Mar-08 23:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.