|
I made a test, you're right.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hello Friends!
I've found an article of Amit Dey for creating Office Addins.
I am using office2003 and VC 6.0. I've created an ATL dll by following
his steps.I've registered this DLL but I can't see this addin when I want
to add this addin in outlook.Can anyone figure out what could be the
problem?
Thanks in Advance.
ritz1234
|
|
|
|
|
Do you see the entry for the addin in the registry.
Is the addin enabled from under the Tools menu. It might be disabled.
Check for wither of these two problems and could be that you come out of it.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanks for the greate response.
yes,the registry entry has been created.
Under Tools menu when I click COM-AddIns.. for adding this,
I see Addin-available dialogbox that is empty.I don't have anything to
select from here.
ritz1234
|
|
|
|
|
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
|
|
|
|
|
First of all, please use <pre> tags to surround (i.e. properly format) code snippets.
Of course both methods you proposed (wrap code in a DLL or convert it into VB6 one) are feasible and both methods require a bit of C programming knowledge: I think it is the opportunity time to start learning this language.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I modified my first post according to your advice. Thanks
In fact i want to learn C/C++ very much but i don't have time now for this. I develop a project for my company and i have to finish this project in 1 week. So if you can help to me i will be so glad. This is really so important for me...
Best Regards
Murat
|
|
|
|
|
DLL definition file (CRCDLL.def)
LIBRARY "CRCDLL"
EXPORTS ComputeCrc
DLL header file (CRCDLL.h)
void __stdcall ComputeCrc(int CRCType, BYTE *Data, int Length, BYTE *TransmitFirst, BYTE *TransmitSecond);
DLL source file (CRCDLL.cpp)
#include "stdafx.h"
#include "CRCDLL.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#define CRC_A 1
#define CRC_B 2
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 __stdcall ComputeCrc(int CRCType, BYTE *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;
}
Visual Basic sample code (actually it is VBA, I haven't VB6 here).
Private Declare Sub ComputeCrc Lib "CRCDLL.dll" _
(ByVal CRCType As Long, Data As Byte, ByVal Length As Long, TrnasmitFirst As Byte, TransmitSecond As Byte)
Private Sub CommandButton1_Click()
Dim Data(2) As Byte
Dim TransmitFirst As Byte
Dim TransmitSecond As Byte
Data(0) = &H12
Data(1) = &H34
Call ComputeCrc(1, Data(0), 2, TransmitFirst, TransmitSecond)
End Sub
Hope that helps.
Please note, VB code assumes the DLL is in the same folder of the VB6 executable, change it according to your needs.
BTW an oldie goldie: http://support.microsoft.com/?scid=kb%3Ben-us%3B106553&x=12&y=15[^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
modified on Thursday, March 20, 2008 11:35 AM
|
|
|
|
|
Muratss wrote: I think i don't need int main block when i use this code as a dll.
True, you'll use DllMain() instead.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
DavidCrow,
You can show me a starting point? I thought i can use "Win32 Dynamic Link-Library" to get this Dll. please show me a starting point and i will try to other things.
|
|
|
|
|
Muratss wrote: I thought i can use "Win32 Dynamic Link-Library" to get this Dll. please show me a starting point...
That's where I'd start.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I read a article and i started. I started with crating "Win32 Dynamic-Link Library" project.
According to article i need 3 files which have extensions as .cpp,.def and .h
I prepared these files
Here my .h file :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
void __stdcall ComputeCrc(int CRCType, char *Data, int Length,
BYTE *TransmitFirst, BYTE *TransmitSecond)
</ctype.h></string.h></stdlib.h></stdio.h>
This is my .cpp file :
#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__stdcall UpdateCrc(unsigned char ch, unsigned short *lpwCrc)
</ctype.h></string.h></stdlib.h></stdio.h>
and this is my .def file : (My project name is Calculate_CRC)
LIBRARY Calculate_CRC
DESCRIPTION 'A C++ dll that can be called from VB'
EXPORTS
ComputeCrc @1
I have an error where UpdateCrc function is. I hope this is a good starting for me..I wait your help...
PS: I need *TransmitFirst and *TransmitSecond values in my project
Best Regards
|
|
|
|
|
Muratss wrote: I started with crating "Win32 Dynamic-Link Library" project.
Which should have given you the neccesary files to start with. For example, I created a project named ComputeCRC, and I have the following files to work with:
ComputeCRC.cpp
ComputeCRC.h
StdAfx.cpp (you'll likely not change this file)
StdAfx.h Start this way, rather than trying to mold your existing EXE code into a DLL.
Muratss wrote: I have an error where UpdateCrc function is.
Likely because of void__stdcall .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I sent my post 2 times. Sorry
|
|
|
|
|
Muratss wrote: You can show me a starting point?
So you think asking questions on an Internet Forum is an efficient way to learn fundamentals of windows programming eh? Good luck.
led mike
|
|
|
|
|
led mike,
I just asked that how i can start. I use visual basic 6.0 . Anyway, thanks for help..
|
|
|
|
|
Hi,
I have some crash in my application -
I know that i need to do something in the workspace setting to activate the creation of the dump file in crash - but i don't know what and how to do it ...
Someone can help me ?
Thanks
|
|
|
|
|
Please refer here[^].
Regards,
Paresh.
|
|
|
|
|
Hi all,
I have a dialog within my dll. I create the dialog as follows:
upgradeHWnd = ::CreateDialog(NULL,MAKEINTRESOURCE(IDD_DIALOGUpgrade),NULL,NULL);
But I receive the following error when calling GetLastError()
ERROR_RESOURCE_TYPE_NOT_FOUND
1813
0x715
The specified resource type cannot be found in the image file.
What am I doing wrong?
Please help
Many thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Try ::CreateDialog(hDLLInstance, give the Handle to Module instance of the DLL.
|
|
|
|
|
Thanks for the reply ....
Rajkumar R wrote: give the Handle to Module instance of the DLL
How do I do that ?
Thanks again
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Look into MSDN for DLLMain callback or GetModuleHandle
|
|
|
|
|
You do not have to just put a module handle into the call to ::CreateDialog(...) , but you have to specify the handle of the module that contains the resource.
For example, if you have loaded a DLL called MyUpdateSystem.DLL and that DLL contains the dialog resource, you would do something like:
::CreateDialog( ::GetModuleInstance( _T( "<code>MyUpdateSystem.DLL</code>" ) ),
MAKEINTRESOURCE( IDD_DIALOGUpgrade ), NULL, NULL ); Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
|