|
No. I cannot. I got the code from libtiff http://www.libtiff.org[^]. One of the tools is tiffcp. I am trying to compile it using VC++.
|
|
|
|
|
I suggest using the /P compiler switch. It will expand that subtract() macro, and then you can see exactly what the problem is.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for your help to expand the codes into a readable fashion. I still have some probelms although I made some progress with some changes.
typedef void biasFn (void *image, void *bias, uint32 pixels);
static void subtract8 (uint8 *i, uint8 *b, uint32 pixels)
{
uint8 *image = i;
uint8 *bias = b;
while (pixels--)
{
*image = *image > *bias ? *image-*bias : 0;
image++, bias++;
}
}
static void subtract16 (uint16 *i, uint16 *b, uint32 pixels)
{
uint16 *image = i;
uint16 *bias = b;
while (pixels--)
{ *image = *image > *bias ? *image-*bias : 0;
image++, bias++;
}
}
static void subtract32 (uint32 *i, uint32 *b, uint32 pixels)
{
uint32 *image = i;
uint32 *bias = b;
while (pixels--)
{
*image = *image > *bias ? *image-*bias : 0;
image++, bias++;
}
}
static biasFn *lineSubtractFn (unsigned bits)
{
switch (bits) {
case 8: return subtract8;
case 16: return subtract16;
case 32: return subtract32;
}
return 0;
}
......
biasFn *subtractLine;
TIFFGetField(in, 258, &sampleBits);
subtractLine = lineSubtractFn (sampleBits);
if (subtractLine) {
......
}
......
However, there are some errors I need to work out. Here are the error messages:
e:\vc++\libtiff\src\tiff\3.7.2\tiff-3.7.2-src\tools\tiffcp\tiffcp.cpp(975) : error C2440: 'return' : cannot convert from 'void (__cdecl *)(unsigned char *,unsigned char *,unsigned long)' to 'void (__cdecl *)(void *,void *,unsigned long)'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
e:\vc++\libtiff\src\tiff\3.7.2\tiff-3.7.2-src\tools\tiffcp\tiffcp.cpp(976) : error C2440: 'return' : cannot convert from 'void (__cdecl *)(unsigned short *,unsigned short *,unsigned long)' to 'void (__cdecl *)(void *,void *,unsigned long)'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
e:\vc++\libtiff\src\tiff\3.7.2\tiff-3.7.2-src\tools\tiffcp\tiffcp.cpp(977) : error C2440: 'return' : cannot convert from 'void (__cdecl *)(unsigned long *,unsigned long *,unsigned long)' to 'void (__cdecl *)(void *,void *,unsigned long)'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Any help is appreciated.
|
|
|
|
|
Notice that lineSubtractFn() is returning a biasFn* , but the function addresses that are actually being returned (i.e., subtract8 , subtract16 , subtract32 ) have a different signature.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The lines 975-977 are
case 8: return subtract8;
case 16: return subtract16;
case 32: return subtract32;
|
|
|
|
|
As I indicated, those three functions do not have the same signature as the biasFn type.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Why, for your own sake, do you compile and use code, that you don't even know what it's doing?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Using macro's to generate functions like that, is very poor programming practice!
besides that, the type uintXX where XX is a number is not available in VC, use unsigned __intXX instead.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
does anyone know how to create an excel chart with c++?
|
|
|
|
|
Just embed the Microsoft Office Chart 9.0 into your program. It's contained in MSOWC.DLL.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I would like users of my program
to be able to launch their
currently installed email client
from within my program.
I would know the proper API call
to find the path to the executable
for the Email client that is currently
installed on a machine.
C/C++, Visual Studio 6.0
Many thanks,
Robert
|
|
|
|
|
Admitedly a cheesy solution, but it should get the job done.
HINSTANCE hInst = ::ShellExecute
(NULL, "open",
"mailto:ravib@ravib.com", <code>
"", "", SW_SHOW); <code>
ASSERT (hInst > 32); /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ravi,
Thanks for reply. I have used that
approach fro text messages.
The purpose of this feature is to allow
the User of my program to attach a file
to an email.
I believe that only very small files
can be attached with ShellExecute().
MAPI is another way to do it but MAPI
is a real mess of DLLs and various
users may not have the right version
of the MS MAPI DLL on their machine.
Also, some email clients like Eudora
require the user to specifically turn
on MAPI, so using MAPI complicates their
lives.
If I can find the default email client
then I can launch it with the attached
file as a command line parameter.
Thanks,
Robert
|
|
|
|
|
Robert Palma Jr. wrote:
I believe that only very small files
can be attached with ShellExecute().
ShellExecute() has no idea what you are using the mailto: protocol for. If there is a problem with the size of an attachment, it would be up to the mail client to deal with it.
If the target machine already has a mail client configured, then MAPI is the way to go. See here for SMTP and MAPI articles.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi David,
Thanks for reply.
Lots of good articles on your link!
Okay, how would you include an attachemnt in the mailto call??
::ShellExecute(NULL, "open","mailto:joe@something.com","","",SW_SHOW);
Thanks a lot,
Robert
|
|
|
|
|
Use this format:
mailto:joe@something.com?subject=Test&attachment="c:\boot.ini"
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi David,
Here is what I tried:
//Shell execute test
//from David mailto:joe@something.com?subject=Test&attachment="c:\boot.ini"
sprintf(buf, "mailto:rpalma@mrtel.com?subject=test&attachment=\"c:\misc\a.txt\"");
ShellExecute(NULL,"open", buf,"","",SW_SHOWNORMAL);
I tried this on NT and Win2K.
I tried this on Eudora and Outlook 2003.
In all cases, the email client loads the 'to' address and the 'subject', but does not seem to know about the attachment.
I have been working on this since May.
Back in May Jim Twine kindly told me (in this forum) that he did not think I could do this with ShellExecute and that I would have to use MAPI.
I have not had success with MAPI so I have been looking at running the mail client from the command line. Outlook and Eudora seem to do this quite well. I just have to find out 'who' is the client and 'where' (directory) he is.
Actually I REALLY don't even want to specify the 'to' address or the 'subject'. I'd like the User to pick the 'to' address from his email-client-addressbook.
I would love to hear anymore thoughts on getting ShellExecute to work. It's seems quite simple and elegant and I use it all the time for other executables.
All the best,
Robert
|
|
|
|
|
Robert Palma Jr. wrote:
sprintf(buf, "mailto:rpalma@mrtel.com?subject=test&attachment=\"c:\misc\a.txt\"");
Should be:
sprintf(buf, "mailto:rpalma@mrtel.com?subject=test&attachment=\"c:\\misc\\a.txt\"");
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi David,
Thankyou for your very quick replys
I fixed my dumb error in formating per your correction - thanks.
Eudora still ignores the attachement.
Outlook (this is different) says the command line switch is
in error.
I have had no luck with a command line reference from Eudora
(Qualcomm) even though I am a re-registered user with the last 4 months.
I will look for a reference on Outlook command line switches, but
previous research efforts in this regard were not fruitful.
Any other ideas?
All the best,
Robert
|
|
|
|
|
Robert Palma Jr. wrote:
Eudora still ignores the attachement.
Admittingly, the attachment part may not be standard. You'll have to read the RFC for mailto: to find out.
Robert Palma Jr. wrote:
Outlook (this is different) says the command line switch is
in error.
I use Outlook 2000 and it worked for me.
Robert Palma Jr. wrote:
I will look for a reference on Outlook command line switches, but
previous research efforts in this regard were not fruitful.
Outlook's command line parameters, if it even has any, has nothing to do with the mailto: protocol.
Check out the SMTP and MAPI links I provided earlier.
Something else you might try is:
char szApp[MAX_PATH];
AssocQueryString(..., ".eml", "open", szApp, sizeof(szApp));
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
In part of my program, I made it give a "yes, no, cancel" MessageBox to the user, and it does that. But the text in it make it span all the way from one end of the screen to the other, making it look ugly. How do I tell it to go to the next line after the first line exceeds a certain length?
|
|
|
|
|
Just insert line breaks ("\n"), in your display string.
If the length of your string varies, then you might want to write a simple funtion that breaks up your input string for you before passing it on to the messagebox
I Dream of Absolute Zero
|
|
|
|
|
Yeah, my text varies. Guess I will have to write a splitting function then, was wondering if there was already one included in MFC. Thanks.
|
|
|
|
|
Here you go.
<code>
void wrapString
(CString strString,
int nWrap,
CStringArray& lines)
{
int nStart = 0;
int nEnd = 0;
do {
<code>
nEnd = nStart + nWrap;
if (nEnd >= strString.GetLength())
nEnd = strString.GetLength() - 1;
<code>
if (nEnd != strString.GetLength() - 1)
while ((nEnd >= 0) && (strString.GetAt (nEnd) != _T(' ')))
nEnd--;
<code>
CString strNextLine;
if ((nEnd - nStart) > 0) {
strNextLine = strString.Mid (nStart, (nEnd - nStart) + 1);
strNextLine.TrimLeft();
strNextLine.TrimRight();
lines.Add (strNextLine);
}
<code>
nStart = nEnd + 1;
} while (nStart < strString.GetLength());
return; /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
You could create a dialog in the ressource dialog editor, with 2 buttons and 1 Editbox. Press Strg+W and the Classwizzard will come up, here you can add variables linked to the Editfield or functions that operate when buttons are pressed and more. If you set up all fine you can include the dialogclass in your app, write the sentense you want to the variable in your dialogclass,say mydialog.DoModal();, react on buttons, and have a good time. No more than 10 minutes on it all.
|
|
|
|
|