|
Hi monrobot13
In my project i am using like this,
if you find a better way than this inform to me.
-------------------------------------------------
CTime StrToDate(char * buffer)//char *buffer CString object
{
int dd,mm,yy,H,M,S;
dd=0;mm=0;yy=0;H=0;M=0;S=0;
CString stemp;
stemp.Format("%c%c",buffer[0],buffer[1]);//date
dd=atoi(stemp);
stemp.Format("%c%c",buffer[3],buffer[4]);//month
mm=atoi(stemp);
stemp.Format("%c%c",buffer[6],buffer[7]);//Year
yy=atoi(stemp);
yy=yy+2000;
stemp.Format("%c%c",buffer[9],buffer[10]);//Hour
H=atoi(stemp);
stemp.Format("%c%c",buffer[12],buffer[13]);//Minute
M=atoi(stemp);
stemp.Format("%c%c",buffer[15],buffer[16]);//Seconds
S=atoi(stemp);
CTime time(yy,mm,dd,H,M,S);
return time;
--------------------------------------------------
anju
|
|
|
|
|
I'm adding images (through an image list which gets the images from icons in my resources) into the columns of my report-style list control, but the images are never transparent, even though I'm using the screen color in my icons, and I specified ILC_MASK when I created my image list.
What am I doing wrong?
Thanks!
|
|
|
|
|
I want to monitor my computer's share directory in the LAN, when some files are deleted or renamed or modified by other computer. I can recored it.
but I don't know all this being done by which computer! How can i do it ?
Thanks a lot!
How can I know which remote computer access which file of my computer?
How can I finished it with MFC or VC?
|
|
|
|
|
Hi there,
Is there anyway to send mail without using Oulook ???
Could you show me example, please ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
http://www.codeproject.com/internet/cmapi.asp
Argue for your limitations, and sure enough, they're yours.
|
|
|
|
|
Thanks again !
Your helps are always useful for me
Regards
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hello Mr.Cheris,
I have problem in using CMapiMessage and CMapiSession classes ...
Please help me ...
It's an example of CMapi classes:
CMapiMessage message;
message.m_To.Add(_T("pjn@indigo.ie"));
message.m_CC.Add(_T("SMTP:pjn@indigo.ie"));
message.m_BCC.Add(_T("SMTP:pj.naughter@softech-telecom.com"));
message.m_sSubject = _T("Demo email using CMapiSession - Please ignore");
message.m_sBody = _T("This is the body of the message\r\nRegards,\r\nCMapiMessage");
message.m_Attachments.Add(_T("C:\\autoexec.bat"));
message.m_AttachmentTitles.Add(_T("my autoexec.bat"));
//Setup the mapi session
CMapiSession session;
BOOL bMapiInstalled = session.MapiInstalled();
//Logon to MAPI
BOOL bLoggedOn = session.Logon(_T("PJ Naughter")); //You will need to change this to use a MAPI profile
//setup on your computer. If you want CMapiSession to
//bring up a dialog to allow a MAPI profile to be
//interactively chosen, then you will need to create
//a Window in your app using the normal MFC mechanims
if (bLoggedOn)
{
//Send the message
BOOL bSent = session.Send(message);
}
First question: Where i should specify Mail Sender in CMapiMessage class ???
Second question: I can't understand what is CMapiSession::Logon function ?
What it do exactly ?
Please help me ...
Regards
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
try asking this on the article that you got the code from, maybe the author can help - i don't know anything about htis calss myself.
-c
Argue for your limitations, and sure enough, they're yours.
|
|
|
|
|
Hello,
I am trying to make a simple CSocket server that will accept multiple connections on the same port.. Here is what I have done.
On my Accept Connections function I do the following:
CMySocket* pSocket = new CMySocket();
pSocket->SetParent(this);
if (m_sListen.Accept(*pSocket))
{
m_connectionList.AddTail(pSocket);
}
else
delete pSocket;
This seems to work.. I can see the m_connectionList grow with each connect..
m_connectionList is a CPtrList.
If only one client connects and sends data, Everything is fine.. Its when Multiple clients connect and I receive data from a client it seems to lock up the server until all the clients disconnect.
I know I am doing this receive function wrong.. How do i figure out what Socket is sending the information so I can receive it???
Here is my receive function
char *pBuf = new char[1025];
CString strRecvd;
int iRcvd;
int iConnections = m_connectionList.GetCount();
POSITION pos = m_connectionList.GetHeadPosition();
while(iConnections > 0)
{
CMySocket* pSocket = (CMySocket*)m_connectionList.GetNext(pos);
iRcvd = pSocket->Receive(pBuf,1024);
if (iRcvd == SOCKET_ERROR)
{
delete[] pBuf;
AfxMessageBox("Socket error");
}
else
{
......
}
iConnections--;
}
I think the problem is in how I am storing the pointers to the Sockets.. but then again, I am new to this so I would be surprised if I am going about this the wrong way..
Any Ideas??
|
|
|
|
|
I think your problem here is that the call to Receive won't return unless some data is present. So if you have multiple clients connected and only one of them is sending data, this will block on clients that are not sending data.
You must do one of several methods to determine if the Socket currently has data. The best ways are Polling and making the Socket nonblocking.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
Hi,what i call to you
first you register to codeproject and strength the family,
ok, r u tried with OnReceive fucntion?
u can search with "CHATSRVR" in MSDN .The article name
is "Demonstrates a Windows Sockets Server"
very nice programm,u can use this without CArchive class also'
anju
|
|
|
|
|
Hey, I have a COM/ATL dll that I created for automating word. I have another application, written in C, that I need to open MS Word and load my dll. I know how to do all of this, but I am having a problem registering my dll. I currently do this:
WinExec("regsvr32 /s WordAddin.dll", SW_SHOWNORMAL);<br />
rc = RegOpenKeyExHKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Office\\Word\\Addins\\Word.Addin", 0, KEY_ALL_ACCESS, &hKey);<br />
<br />
if(rc != ERROR_SUCCESS)<br />
{<br />
WinExec("regsvr32 /s /u WordAddin.dll", SW_SHOWNORMAL);<br />
WinExec("regsvr32 /s WordAddin.dll", SW_SHOWNORMAL);<br />
}
At the end of my processing, I am unregistering the dll. It seems to work part of the time. The problem is that every once in a while, I click the button to launch MS Word from w/in my application but the dll is not getting registered. When I go out and manually look in the registry, it is not in the there. I have no idea why it is not registering the dll. Can anyone help or give me some insight into why this is happening and how I can fix it? I have looked and there are LOTS of posts about registering dlls and from what I could tell, I am doing it correctly. But something is wrong and I do not know what. It happens sporadically. PLEASE HELP!!!!!
|
|
|
|
|
WinExec("regsvr32 /s ... //line 1
rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ... // line 2 I'm far for sure about whant I'm going to say, but anyway: maybe the problem lies in the fact that WinExec works asynchronously, so by the time line 2 is reached it is possible that sometimes regsvr32 has not completed. In such cases, the last part of the code (which seems to me like a retry, am I right?) executes: again the lack of synchronicity can lead (in unlikely situations) to a wrong sequence of installations and uninstallations. If my guess is right, the problem shoul disappear by either:- Inserting generous
Sleep s after all WinExec s (not an elegant solution). - Using
CreateProcess instead of WinExec , which provides means for your program to wait till regsvr32 terminates before proceeding with the following step.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You are correct, I am doing the check on the regisry with the hopes of retrying if the first attempt failed. I did initially try the CreateProcess but I kept getting a GPF when my program would reach the createprocess code. So I went with this code instead. The unable to register was happening before I put the RegOpenKeyEx call in though. It seems to run through the code, it just doesn't register the dll. Any thoughts on the CreateProcess, what I might need to do that I wasn't doing before? Can you give me a code snippet of what you think it should be? I appreciate any and all help you have and/or will provide!!!!
|
|
|
|
|
Here's a sketch of how CreateProcess can be used:
STARTUPINFO si;
ZeroMemory(&si,sizeof(STARTUPINFO));
si.cb=sizeof(STARTUPINFO);
PROCESS_INFORMATION pi;
if(!CreateProcess(
NULL,
(LPSTR)"regsvr32 /s WordAddin.dll",
NULL,
NULL,
FALSE,
DETACHED_PROCESS,
NULL,
NULL,
&si,
&pi)){
}
WaitForSingleObject(pi.hProcess,INFINITE);
DWORD dwExitCode;
GetExitCodeProcess(pi.hProcess,&dwExitCode);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hey, THANKS!!!!!
I used the snippet and it did differ slightly from my original attempt. Sure enough, after using the CreateProcess, I have not had a problem with it not registering the dll. YOU RULE!!!
|
|
|
|
|
Hi,
I've read the two articles on this site "Creating Custom Controls" and "The Art Of Subclassing" by Chirs Maunder. They're pretty nice but i'm still confused.
Now, i want to build a custom control derived from CWnd.
As far as i understood, if we want to initialize something we use OnPaint function. Is that right?
And how do we add other controls to our control? For example, i want to build some kind of a table and i want column headers drawn on initialization. How and where should i do that?
And finally can you recommend me other tutorials about creating custom controls?
I'm really confused here, any bit of help is highly appreciated. Thanks.
|
|
|
|
|
Declare a class inheriting directly from CWnd. Put the initialisation code in the Create() member. You should also create any child windows at this point. FOr example, you mentioned column headers.
To do that you would declare a member varaible of type CHeaderCtrl in the .h file and call Create on it in the Create() of your Cwnd derived class. You would also need to add code to the OnSize of you CWnd class to place the headre control in the correct place on the CWnd's main window. When it comes to drawing the control you put your drawing code i nyour OnPaint() and make sure you don't overwrite areas taken up by the child controls.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Thanks for your reply. Now i have a starting point and thinks will sink better as i go the way.
|
|
|
|
|
When I right click on my tree, I would like to change the selection before displaying the context menu. Just like the behaviour in the class view window of VS.
How do I achieve this?
It's probably obvious, and just can't see it.
Thanks,
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
::GetMessagePos, CTreeCtrl::ScreenToClient, CTreeCtrl::HitTest and CTreeCtrl::SelectItem.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
I'm interested in windows programming and I was looking for some books but I don't know wich one to buy. Do you have any suggestions?
marekm
|
|
|
|
|
If your interested in MFC, then I'd recommend "Windows Programming with MFC" by Jeff Prosise. It's helped me out, along with the help I've gotten out here.
Good Luck!
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
Second that... Jeff's book is great.
Also Sams 'teach yourself c++ in 21 days is quite good'. There's no Windows stuff in it which is great because it sidetracks you from learning the theory.
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
|
|
|
|
|