|
Thanks! Got that working.
Now, I will see if this one works for my chat. For my FTP client it does!
DKT
|
|
|
|
|
Hi
I have a tab control with owner draw enabled in which I am drawing a icon and a text. It works perfectly fine when the TCS_VERTICAL option is not selected. But when I select TCS_VERTICAL option I am not able to see the text. Could anyone knows a solution for this?
Regards
|
|
|
|
|
Are you drawing the text correctly - i.e. does your custom drawing code respect the tab control's orientation?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Can't we draw the text horizontally(left to right) in a Vertical tab? I have set the tab sizes accordingly, but I can't see any text being displayed.
|
|
|
|
|
You'll need to draw your text within the tab's bounds (regardless of the tab's orientation) if you want to see it.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi
I need to remove a character from a string
normally i would use
mystr.Remove('%')
to remove the % char
but i need to remove the ' char
i cant put mystr.Remove(''')
i know its somthing simple, but cant think what
any ideas
ta
si
|
|
|
|
|
si_69 wrote:
i cant put mystr.Remove(''')
try mystr.Remove('\'')
suhredayan There is no spoon.
|
|
|
|
|
Try escape sequence -> mystr.Remove('\'');
Rather basic issues when operating with strings. e.g. if you want to put filename (with path) into string, you should do it like this:
char szFile[_MAX_PATH]="C:\\Myfolder\\Myfile.txt";
|
|
|
|
|
i have made a simple mailslot client server program on vc++ without MFC.but writeFile is not working on windows2000,while it works correctly on windows 98 and XP.
PLEASE HELP ME
|
|
|
|
|
What is the error you getting. Are you doing an asynchronous writting?
suhredayan There is no spoon.
|
|
|
|
|
i am doing synchronous transfer of data from ane process to another .in client the write file function is giving error 1231 -> unable to access network location. but why ?
this functioin works well in windows xp
the client program is
#include<windows.h>
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include<iostream.h>
#include<malloc.h>
#include<process.h>
HANDLE hSlot1;
HANDLE hStdOut;
HDC hdc;
BOOL WINAPI WRITESLOT( HDC hdc)
{
LPSTR lpszMessage = "Message for sample_mailslot in primary domain.";
BOOL fResult;
HANDLE hFile;
DWORD cbWritten;
hFile = CreateFile("\\\\*\\mailslot\\sample_mailslot.txt",
GENERIC_WRITE,
FILE_SHARE_READ, // required to write to a mailslot
(LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
cout<<"Primary domain";
return FALSE;
}
cout<<hfile;
="" fresult="WriteFile(hFile," lpszmessage,="" lstrlen(lpszmessage)="" +="" 1,="" include="" terminating="" null="" &cbwritten,="" null);
="" cout<<fresult;
="" int="" k="0;
" cout<<k;
if="" (!fresult)=""
{="" cout<<"writefile="" error";
="" return="" false;=""
}=""
cout<<
"writefile="" successful.";
=""
fresult="CloseHandle(hFile);"
if="" cout<<"closehandle";
=""
cout<<"closehandle="" successful.";
return="" true;=""
="" }
void="" main="" (void)
{
="" hdc="GetDC(NULL);
" writeslot(hdc);
}
<b="">and the server is :
#include<windows.h>
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include<iostream.h>
#include<malloc.h>
#include<process.h>
HANDLE hSlot1;
HANDLE hStdOut;
HDC hdc;
BOOL FAR PASCAL Makeslot(HDC hdc)
{
LPSTR lpszSlotName = "\\\\.\\mailslot\\m";
// The mailslot handle "hSlot1" is declared globally.
cout<<" wwwwwwwwww";
hSlot1 = CreateMailslot(lpszSlotName,
0, // no maximum message size
MAILSLOT_WAIT_FOREVER, // no time-out for operations
(LPSECURITY_ATTRIBUTES) NULL); // no security attributes
if (hSlot1 == INVALID_HANDLE_VALUE)
{
//ErrorHandler( "CreateMailslot"); // local error handler
cout<<"unable to cre";
return FALSE;
}
cout<<"created mial successfullly";
// TextOut(hdc, 10, 10, "CreateMailslot successful.", 26); */
return TRUE;
}
BOOL WINAPI Readslot( HDC hdc)
{
DWORD cbMessage, cMessage, cbRead;
BOOL fResult;
LPSTR lpszBuffer;
CHAR achID[80];
DWORD cAllMessages;
HANDLE hEvent;
OVERLAPPED ov;
cbMessage = cMessage = cbRead = 0;
hEvent = CreateEvent(NULL, FALSE, FALSE, "ExampleSlot");
ov.Offset = 0;
ov.OffsetHigh = 0;
ov.hEvent = hEvent;
// Mailslot handle "hSlot1" is declared globally.
cout<<"reading\n";
fResult = GetMailslotInfo(hSlot1, // mailslot handle
(LPDWORD) NULL, // no maximum message size
&cbMessage, // size of next message
&cMessage, // number of messages
(LPDWORD) NULL); // no read time-out
if (!fResult)
{
cout<<"GetMailslotInfo";
//ErrorHandler(hwnd, "GetMailslotInfo");
return FALSE;
}
if (cbMessage == MAILSLOT_NO_MESSAGE)
{
// cout<<"MAILSLOT_NO_MESSAGE";
return TRUE;
}
cAllMessages = cMessage;
while (cMessage != 0) // retrieve all messages
{
// Create a message-number string.
wsprintf((LPSTR) achID,
"\nMessage #%d of %d\n", cAllMessages - cMessage + 1,
cAllMessages);
// Allocate memory for the message.
lpszBuffer = (LPSTR) GlobalAlloc(GPTR,
lstrlen((LPSTR) achID) + cbMessage);
lpszBuffer[0] = '\0';
fResult = ReadFile(hSlot1,
lpszBuffer,
cbMessage,
&cbRead,
&ov);
if (!fResult)
{
cout<<"ReadFile error";
// ErrorHandler(hwnd, "ReadFile");
GlobalFree((HGLOBAL) lpszBuffer);
return FALSE;
}
// Concatenate the message and the message-number string.
lstrcat(lpszBuffer, (LPSTR) achID);
// Display the message.
/*MessageBox(hwnd,
lpszBuffer,
"Contents of Mailslot",
MB_OK);
*/
GlobalFree((HGLOBAL) lpszBuffer);
fResult = GetMailslotInfo(hSlot1, // mailslot handle
(LPDWORD) NULL, // no maximum message size
&cbMessage, // size of next message
&cMessage, // number of messages
(LPDWORD) NULL); // no read time-out
if (!fResult)
{
cout<<"error GetMailslotInfo";
//ErrorHandler(hwnd, "GetMailslotInfo");
return FALSE;
}
}
return TRUE;
}
BOOL WINAPI WRITESLOT( HDC hdc)
{
LPSTR lpszMessage = "Message for sample_mailslot in primary domain.";
BOOL fResult;
HANDLE hFile;
DWORD cbWritten=0;
hFile = CreateFile("\\\\*\\mailslot\\m",
GENERIC_WRITE,
FILE_SHARE_READ, // required to write to a mailslot
(LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
//FindFirstFile("\\\\*\\mailslot\\sample_mailslot",&FindFileData);
if (hFile == INVALID_HANDLE_VALUE)
{
cout<<"Primary domain";
//ErrorHandler(hwnd, "Primary domain"); // local error handler
return FALSE;
}
cout<
|
|
|
|
|
tulika_8_2003 wrote:
i am doing synchronous transfer of data from ane process to another .in client the write file function is giving error 1231 -> unable to access network location. but why ?
this functioin works well in windows xp
I'v not gone through your code. BTW check this link Mailslot programs may be slow in Windows 2000[^]
suhredayan There is no spoon.
|
|
|
|
|
Hi,
I have to validate a field entry on kill focus of the edit control.If the user enters invalid data, a error message box should pop up and focus should remain on the edit control only so as to allow user to change the wrong entry. The problem is, this validation should not occur when user is exiting from the dialog like pressing cancel or exit. But when he clicks on the cancel button, kill foucs gets called and if the user has entered wrong data, error message will pop. Infact he won't be able to exit until he corrects the entry, which is ridiculous.
To avoid this problem, I switched validation from kill focus to SetFocus of the next control.
The program behaviour is --
User enters data in Control A
Then he puts cursor on Control B. Control B::On Set Focus validates the ControlA:data. IF wrong, pops up the message box and sets the focus to Control A.
But whenever user presess OK on the message box, focus again goes to Control B rather than going to Control A. Again validate is called and again the message box pops up. This goes in loop.
I didn't want to put the validations on En_change or use a bool vble for skipping the validations next time.
Any ideas will help a lot both on killfocus and setfocus front.
|
|
|
|
|
Hi there,
All you have to do is create a handler for trapping the EN_KILLFOCUS so that you get the message that the edit control is loosing the focus. So inside the handler put the MessageBox that you want to popup. When the user clicks on OK on the dialog box, edit control looses the focus. So to ensure that the focus is on the edit control, create a control variable for the edit control suppose(m_control) do the following after the statement following the MessageBox
CPoint set(0,0);
m_control.SetFocus();
m_control.SetCaretPos(set);

|
|
|
|
|
Validating data during a WM_KILLFOCUS message indicates a bad design. That message gets sent in too many situations so picking and choosing which one(s) you are interested in will lead to trouble. The most reliable way of validating data on a dialog box is to check the state of each control anytime a control changes. Set up a "change" handler for each control and do the validating in it. If all conditions are met, only then do you enable the OK button. I do this for each of my dialogs. It is very clean and reliable. Read here for more.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
aaaah.....if ur specifiaction demandz u to have a validation of the data entered onkillfocus,then herez ur answer.....
click thiz.....[^]
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
hiho@ll
i'm using outport (outport.sourceforge.net) to extract contacts from outlook
outport uses an COleDispatchDriver Wrapper and the InvokeHelper method to get the data it needs
the invokehelper function gets a DISPID parameter, which identifies the methode which should be called
my problem is how can i write some contacts back to outlook
and anybody knows where i get a list of available methods for invokehelper!?
i think i could use invokehelper, to add new contacts to outlook, but how?
thx@ll
|
|
|
|
|
Hi Community,
how can i implement a Email functions in my MFC Program, i have to create a function that allows a sending Emails from Program! Not a MAPI i thing something like SMTP? Problem is that i dont have any experience with WinSock or something litke this!!!
thanx!
Mirsad
|
|
|
|
|
|
Hi,
thanx for the link, but author says that i need VS7(.Net) and i have a Visual Studio 6 (MFC), is there any problems?
mirsad
|
|
|
|
|
Yeah, the author uses CSMTPConnection declared in atlsmtpconnection.h which comes with ATL 7. Here is another link[^] but this will require you to specify a smtp server address.To get the smtp server address depending on the email address you check this link [^]
suhredayan There is no spoon.
|
|
|
|
|
Hi i am building an application which consists of 2 projects, ie. my main app which is the main project, and a second projet which is essentially a bunch or libraries for the first/main app to use. - in a single "solution".
Strict visual studio.net 2003 terminaology here.
I am trying to use a dialog from the library type project, in my main project. everytime i compile the solution i get
c:\Code\vision\CustomNameDlg.h(24) : error C2065: 'IDD_DIALOG_CUSTOMNAME' : undeclared identifier
Now when i call this dialog from a clas within the same project everything works fine? Is there some trick to calling a dialog from a different project, but part of the same "solution"??
Thanks for any help,
James
|
|
|
|
|
jammin PPP wrote:
c:\Code\vision\CustomNameDlg.h(24) : error C2065: 'IDD_DIALOG_CUSTOMNAME' : undeclared identifier
Currently your main application and library project has separate resource.h and .rc files. The error is because IDD_DIALOG_CUSTOMNAME is not there in the resource.h file of main project. Refer this TN [^] article for using multiple resource files within same project.
suhredayan There is no spoon.
|
|
|
|
|
add macro #include "resouce.h"
|
|
|
|
|
Hi,
This is sundar...
I had a problem with connecting the Ms-Access database through VC++ with an security protection.
I had create a table in Ms-Access with a security password. Then i gone to control pannel and created an DSN name.
After that, i open my VC++ application, there i created a new class by inheriting CRecordset. Its ask for Connection. I select my DSN in ODBC connection, then it ask for a password, where i given the password, which i created in access. After that i select my req table.
Then i try to run my application . I faced that, when ever i am trying to open my database through VC++ code. its asking me a password frequently.. This should not be occur. So, where i have to set my password in VC++ code..
This is urgent....
If any one knew. pls revert back soon
Shanmuga Sundar.V
|
|
|
|
|