Print Page | Close Window

passing CString arguments to dll functions

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2824
Printed Date: 15 Jul 25 at 12:35AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: passing CString arguments to dll functions
Posted By: WendellSmith
Subject: passing CString arguments to dll functions
Date Posted: 10 Feb 14 at 3:32PM
I am hoping this is easy -- Is there an easy way to convert a CString to the type required for the dll calls (wchar_t *)?

I have tried a bunch of things but not found the magic code :)

CString Label = "xx";

ConvertedLabel = ??; // how to get the CString Label into a format to pass into functions?

QP.DrawText(100, 500,  ConvertedLabel); // this  does not work.

Does anyone have a suggestion how to do this?  [we are using MSVC6]

Thanks




Replies:
Posted By: Ingo
Date Posted: 11 Feb 14 at 7:59AM
Hi Wendel!
 
Microsoft will help:
http://msdn.microsoft.com/de-de/library/ms235631.aspx" rel="nofollow - http://msdn.microsoft.com/de-de/library/ms235631.aspx
I think there'll be a similar page in english, too ;-)
 
Cheers and welcome here,
Ingo
 


-------------
Cheers,
Ingo



Posted By: AndrewC
Date Posted: 11 Feb 14 at 1:17PM
Wendell,

Can you try calling QP.DrawTextA  - 'A' is for the Ansi string version.  It should get you started.


Have you tried using CStringW ?

Here is some code that compiles and runs in an VS2010 MFC project.

if (QP->UnlockKey(_T("<<< insert license key here >>>")) == 1)
{
int ret;

QP->AddTrueTypeFont(L"Wingdings", 0);
                QP->SetOrigin(1);
                QP->DrawText(100, 20, L"Hello World");
                QP->SetTextSize(18);

ret = QP->DrawText(100, 500, _T("Hello world"));
ret = QP->SaveToFile(_T("HelloFromDLL.pdf"));

CStringW  filename = L"f:\\downloads\\1.pdf";
ret = QP->LoadFromFile(filename, L"");

delete QP;
}

Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk