|
Hello,
Trying to decode a tiff file from eFax with libtiff. I noticed that the decoded image is shorter. How do I detect and handle a tiff-fax file has horizontal ratio of 2:1? I noticed that acdsee and irfanview can decode the fax file with the right ratio.
Thanks!
|
|
|
|
|
Hello all, I was wondering if anyone can help me with this little problem. I have a project in which I use MDI. When it starts up the program opens a blank document. I would like it NOT to open any document at all and rely on the use the open a file. Any idea how to do that? Thanks
|
|
|
|
|
plonk this in your app's InitInstance() function where the original version is:
// Dispatch commands specified on the command line
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
if (!ProcessShellCommand(cmdInfo))
return FALSE;
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I'm using MAPi to email attachments (thanks to a couple articles here on CodeProject!), But I think the behavior I want is not available in MAPi.
I want the application to open the default mail program (i.e. Outlook) with the attachment added then in Outlook the user can then add comments, select address etc. the problem is MAPi sends the email directly to the outbox bypassing Outlook.
I've seen this behavior, opening Outlook and adding an attachment, in many programs and assumed it was part of MAPi.
What am I missing?
|
|
|
|
|
Hi, how can I access a file in home directory of current user? Can I use a filename like "~/appname/file.ini" or what do I need to do? It should work with WinME/2000/XP? Thanks in advance!
|
|
|
|
|
XP and 2000 have a environmental variable %user% that will give you the name of the logged in user. I guess that should be able to put used in a filename.
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
Hello there,
<blockqoute> is there a way to programmatically add user-accounts in NT?
- YES!
- How?
And why aren't the lsa* functions like lsaopenpolicy and such documented (in MSDN)?
(Where is it documented?)
Georg Haan
|
|
|
|
|
Georg Haan wrote:
is there a way to programmatically add user-accounts in NT?
Yes
Georg Haan wrote:
- How?
Sorry, don't remember right now
Georg Haan wrote:
And why aren't the lsa* functions like lsaopenpolicy and such documented (in MSDN)?
(Where is it documented?)
They are documented in the latest MSDN Library (It's the one I have installed, so it's the only one I have checked)
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Start with NetUserAdd() function and read documentation around it, it's quite easy to get it working.
Martin
--------------------------------------------
C'mon we all know computers are experimental devices and should only be used for playing games.
Using them for alternative stuff like business, is clearly not using them for what they are intended.
Colin Davies
|
|
|
|
|
Hello all,
I have an MDI application that displays bitmaps on the MDI child windows.
I made a new Dialog window class. How can I get OnDraw to draw the bitmaps to these dialog window instead of the MDI Child Windows?
I read something about switiching View Classes, but I am lost as to why I would/what that really means/and what it is for.
Do I have to do something to have OnDraw draw to the Dialog windows instead of the MDI Child Windows?
Pleae help,
NickOne
|
|
|
|
|
you'll have to handle the OnPaint function in the dialog class. you can really redirect OnDraw/OnPaint fromone window to another - each window (wether view, dialog, button, or whatever) draws itself.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Cool! Thanks!
Does this apply as well (making an OnDraw/OnPaint handler) if I make a new MDI child class?
NickOne
|
|
|
|
|
yep. pretty much anytime you want a view window to show something, you have to draw it yourself in OnDraw. the exceptions are the formview and tree/listview things where you're really just using standard controls as a view.
for dialogs and most other controls, you do the drawing in the OnPaint function.
i find the best way to do image drawing in a dialog is to take a static rectangle control and fence off an area within the dialog. then, when it's time to draw (in nPaint) i find that control's rectangle, deflate it a little and draw inside of it. that way, you a) have a nice rectangluar border around the image and b) you can design around the image area, if you need other controls in the dialog.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
I would like to give you one more piece of information that you might find helpful as to why the OnDraw and OnPaint methods exist and when to use them.
OnPaint is a message handler that handles an actual message from windows (WM_PAINT). Every window will get a WM_PAINT message, and in turn the OnPaint handler will be called when a window needs to be repainted. This includes buttons, static controls, treeview controls, dialogs and so on, even the MDI children that you are handling the OnDraw method.
The OnDraw method is a method in MFC that is usually used for windows that represent documents. The default action for the OnPaint handler of a document window prepares a HDC and calls the OnDraw handler. All of your painting that is required for your document should go in the OnDraw handler. This is because MFC also has the OnPrint or WM_PRINT message call the same OnDraw handler that you used to draw your window. The only difference is that it passes you a HDC that is for a printer rather than your monitor. This allows you to perform the painting code for your document in one place, and the MFC framework can take advantage of that.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi everyone, l'm currently working on linking a program to its GUI application. And l was wondering if executing the program from within the GUI code is the correct way to approach it. lf it is, can someone give me some suggestions as to how l should go about it? l've tried calling the system command in my code (eg. system("program < inputDataFile") ), but doing so will result in a black window popping up. l do not want to see a black window flash for a couple of seconds everytime l run my program, so l hope there is another way to do this.
Any comments will be appreciated, thanks!
|
|
|
|
|
See this article.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
To keep the black window from popping up, try WinExec with the SW_HIDE flag.
Even better would be to redirect output entirely, not to a file, but to a pipe. Nothing gets written to a drive this way... Microsoft has sample code for this, you'l find ithere.
Georg Haan
|
|
|
|
|
Try CreateProcess
Todd Smith
|
|
|
|
|
For the following code
int DLLGetKeywords( char* keyBuf)<br />
{<br />
char buffer[] = " type1,depth,type2,range,type3*";<br />
*strchr(buffer,'*') = 0;
AfxMessageBox(buffer); <br />
char *pc,*pc1;<br />
for (pc = buffer ; *pc ; pc = strchr(pc,0) + 1) <br />
{<br />
<br />
char* pc1 = strchr(pc,',');
if (pc1) *pc1 = 0; <br />
}<br />
<br />
<br />
strcpy(keyBuf,buffer);<br />
AfxMessageBox(buffer); //////////////msgbox2
The first msgbox has an output as expected: " type1,depth,type2,range,type3*"
The second msgbox has an output of "type1". Thats all.
ALl thats happening in the routine is that commas are being replaced by nulls. I thought that its because the msgbox only "reads" upto the first null. But when I go to populate a listbox with this buffer, (post messagebox2), i only get "type1" in it.
Any light on this mystery?
Thanks,
ns
|
|
|
|
|
ns wrote:
ALl thats happening in the routine is that commas are being replaced by nulls.
When you do this, you terminate the string. The array is filled with characters and nulls, but when you output them from the beginning, it only goes as far as the first null.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
I suspected this. So how does one extract the words buried in a string which has nulls between words?
I have stuff like "abc\0aaa\0ddd\0" which is my attempt at saying I've got nulls between words? I'm using this:
<br />
void CTrain1View::popDisplayList(int popDisplayFlag, char * buffer)<br />
{<br />
if (popDisplayFlag)<br />
{<br />
char* pc;<br />
<br />
CString string;<br />
int nListIndex = 0;<br />
for (pc = buffer ; *pc ; pc = strchr(pc,0) + 1) <br />
{<br />
char* pc1 = strchr(pc,',');
if (pc1) *pc1 = 0;
string = pc;<br />
int nItem = m_listdisplay.InsertItem(nListIndex,string);<br />
<br />
}<br />
<br />
but my listbox gets one extra line of garbage after the first five (buffer has five words in it, commma delimited)entries. I dont see why.
Any clues? I do thank you for confirming my suspicion regarding the buffers condition after putting in the nulls.
|
|
|
|
|
My suggestion would be to use the 'strtok' function (string to token) on the original string with the commas. On the first call, you specify the source string and a set of delimiters (a comma, in your case) and the function returns a pointer (I think) to the first sequence of characters up to the specified delimiter. On subsequent calls, the source string is specified as NULL, as the function maintains its own buffer. Each consecutive call will return a pointer (I think) to the next sequence of characters up to the specified delimiter. When strtok returns NULL, there are no more tokens.
Two things:
1) strtok replaces the found delimiter with a NULL, which you don't have to worry at all about.
2) the set of delimiters can be changed on each call, if desired. This is handy for parsing a sequence where things are not always the same.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Thank you very much for the strtok - i didnt know about it. I appreciate your responses - they are most helpful!
ns
|
|
|
|
|
Ugh, code like this is difficult to maintain and won't pass a review. Now back to our regularly scheduled broadcast...
The first msgbox has an output as expected: " type1,depth,type2,range,type3*"
This surprises me. The output shouldn't include the trailing asterisk.
The second msgbox has an output of "type1". Thats all.
That makes sense, because you've happened to have (eventually) replaced the first comma with a null byte. Btw, the loop logic (specifically the increment) is suspect. What do you want to have happen?
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I was trying to extract words out of a buffer which has null terminators between words. I was supplying myself with a fake buffer of the sort I expect to get, to see if my code would process the buffer correctly. You are right - there was of course no * in the messageBox. In this thread char * got much clearer to me. I like CStrings better but I have to use whatever someone elses dll supplies. Thanks much.
|
|
|
|