|
How to make a pause in the unfolding of a function ? I'd to make a pause of 1 second.
Thx
|
|
|
|
|
Sleep
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
hello
pls help me.i am a begginer. i tried a keyboard hook program for unicode.
using my program i can display unicdoe chacter in notepad. but it is not working in word or wordpad. part of my code is given .
LRESULT CALLBACK KeyProc( int nCode, WPARAM wParam, LPARAM lParam )
{
hwndw= GetFocus();
if (nCode < 0)
{
Sleep(0);
return CallNextHookEx(m_hHookKey, nCode, wParam, lParam);
}
Sleep(0);
if (nCode == HC_ACTION)
{
if (lParam & 0x80000000)
{
Sleep(0);
PostMessage(hwndw, WM_KEYUP, wParam, lParam);
}
BYTE ks[256];
GetKeyboardState(ks);
WORD w;
UINT scan;
int buff;
scan=0;
ToUnicode(wParam,scan,ks,&w,buff,0);
ch_u=TCHAR(w);
if(ch_u!=8)
{
PostMessage(hwndw,WM_KEYDOWN,8,0);
}
if(ch_u>=32 && ch_u<=126)
{
switch(ch_u)
{
case 'A':
ch=3347;
'
'
'
'
}
PostMessageW(hwndw,WM_CHAR,ch,0);
is there any way to change the character i have typed ,before reaching the destination window.
thanking you
arthi
|
|
|
|
|
Dear Friends,
I got a dialog window and i am displaying a small bitmap on the window. I placed a "picture control" on the dialog and give it the path of my resource bitmap. So far so good.
We all know that bitmap is square shaped and has some background. The background of my bitmap is of same color as that of the default color of Windows 2000's Window. As such my bitmap gives illusion of "Icon" because its background color is masked with the parent window color. I developed the application on Windows 2000 machine.
But the problem is when i run my application on Windows 98 or XP. The default window color on these Operating Systems is different than that of Windows 2000. So the background color of my bitmap becoms apparent. This looks very ugly. I want to give illusion of an Icon and not bitmap.
Can you tell me some appropriate solution ? One solution in my mind is to convert my bitmap into icon. But i don't know any tool that can do so. By Bitmap has some background and i want to completely remove that background and extract the remaining image as an icon. Is there any tool available that can help me ?
Imtiaz
|
|
|
|
|
Hi,
my proposal: ownerdraw
Load the bitmap and draw them to the area
take a look at the function (-link):
LoadImage()[^]
and the parameter LR_LOADTRANSPARENT
HTH
Frank
|
|
|
|
|
You can make parts of your Bitmap transparent.
You have to use an imagelist (CImageList I think)
Then you have to make a mask of your original bitmap with only TWO colors (eg. black and white) Then the black stuff is made transparant while the white stuff is visible.
Search on CBitmap, CImageList and stuff and you'll find it.
(I have done it once, but I can't remember the whole stuff)
Hope it helps
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
Rather than a bitmap, how about using an Icon. They have transparency already built-in and you can use either a static control or manual drawing.
onwards and upwards...
|
|
|
|
|
Hi,
I m trying to use InternetConnect() function to connect with FTP site...specifying valid USERNAME & PASSWORD but that always returns NULL, but when i test it using "anonymus" as USERNAME & PASSWORD it works fine.
But I want to login to the FTP using specific USERNAME & PASSWORD..
The sample snippet that is being successfull is :
HINTERNET hIntConnect = InternetConnect(hInet,"ftp.corsoft.net",INTERNET_DEFAULT_FTP_PORT,_T("anonymous"),_T("anonymous"),INTERNET_SERVICE_FTP,0,NULL);
And the code snippet that fails is :
HINTERNET hIntConnect = InternetConnect(hInet,"ftp.corsoft.net",INTERNET_DEFAULT_FTP_PORT,_T("UserName"),_T("Password"),INTERNET_SERVICE_FTP,0,NULL);
Does any one have idea then please reply me urgently. Or is there any other idea to login to the FTP site with specific USERNAME & PASSWORD.
Thanks in advance.
Chirag.
|
|
|
|
|
I can't spot any obvious error, attached is the code I use sucessfully, I know it works on 95, 98, NT and XP.
The obvious question is what is the error return? I have removed my error trapping so you can see the wood for the trees!
m_hInetSession = InternetOpen(_T("FtpUpload"),<br />
INTERNET_OPEN_TYPE_PRECONFIG,<br />
NULL,<br />
NULL,<br />
INTERNET_INVALID_PORT_NUMBER);<br />
<br />
DWORD dwFlag = m_bPASVMOde ? INTERNET_FLAG_PASSIVE : 0;<br />
<br />
m_hFTPConnect = InternetConnect(m_hInetSession,<br />
strURL,<br />
(INTERNET_PORT) m_nPort,<br />
strUser,<br />
strPWD,<br />
INTERNET_SERVICE_FTP,<br />
dwFlag,<br />
NULL);
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Thanks a lot for reply.
The error return is ErrorCode : 12014 i.e. The request to connect and log on to an FTP server could not be completed because the supplied password is incorrect. Eventhough I am specifying correct password.
Regards,
Chirag.
|
|
|
|
|
You could try ravi's suggestion or my favourite use telnet and connect to port 21 then type
USER username
PASS mypassword
That way you can see what the server is sending
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Hi, thanks for reply again.
I am now handling the situation in other way ... i.e. See my Code snippet below..
HINTERNET hIntConnect = InternetConnect(hInet,"ftp.corsoft.com",INTERNET_DEFAULT_FTP_PORT,NULL,NULL,INTERNET_SERVICE_FTP,0,NULL);
if (InternetSetOption(hIntConnect,INTERNET_OPTION_USERNAME,"UNIVERSE\\UserName",sizeof("UserName"))==FALSE)
int err=GetLastError();
if (InternetSetOption(hIntConnect,INTERNET_OPTION_PASSWORD,"Password",sizeof("Password"))==FALSE)
int err=GetLastError();
ret = FtpGetCurrentDirectory(hIntConnect,CurDir, &CurDirSize);
if (ret == FALSE)
int err=GetLastError();
ret = FtpSetCurrentDirectory(hIntConnect,"\kothi\cc");
if (ret == FALSE)
{
int err = GetLastError();
InternetGetLastResponseInfo(&nErr, sBuff, &nBuffLen);
}
The usually works fine except last action i.e. to Set the Current Working Directory. I am easily able to get the file from the root directory but not able to Set the Current working Directory.. The error i m getting id ErrorCode:12003.
Any Idea....that helps me a lot.
Thanks in advance.
Regards,
Chirag
|
|
|
|
|
Anonymous wrote:
ret = FtpSetCurrentDirectory(hIntConnect,"\kothi\cc");
shouldn't it be "/kothi/cc" or "./kothi/cc/" or "kothi/cc"? I can't remember off hand
Make sure you are really where you think you are before you try and change directories.
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Anonymous wrote:
is there any other idea to login to the FTP site with specific USERNAME & PASSWORD.
You can specify the username and password as part of the URL - the format is "ftp://username :password @corsoft.net", where username is the username and password is the password.
You can verify this by opening an instance of Windows Explorer (not IE) and typing this in the address bar. You should see the file system on the FTP server. This is what I use as my FTP client.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
hello again,
I need to do 3 steps on a file, I've written 3 functions ( step1(),step2(),step3()), all of those steps requires the execution of ShellExecuteEx but I need them do be done sequentialy with mutual exclusion.
I've created a semaphore using CreateSemaphore but step2() starts before step1() finished. Here's the code
<br />
HANDLE hSemaphore=NULL;<br />
....
<br />
Semaphore=CreateSemaphore(NULL, 1, 1, NULL);<br />
if(Semaphore ==NULL)<br />
{<br />
MessageBox(hwndMain, "Unable to assure mutual execution,can't continue","MUTEX",MB_OK|MB_ICONERROR );<br />
break;<br />
}<br />
//into step1()
<br />
dwWaitResult=WaitForSingleObject(Semaphore,0L);<br />
switch(dwWaitResult)<br />
{<br />
case WAIT_OBJECT_0:<br />
if(ShellExecuteEx(&sei)== NULL)<br />
{<br />
ReleaseSemaphore (Semaphore,1, NULL);<br />
return false;<br />
}<br />
ReleaseSemaphore (Semaphore,1, NULL);<br />
return true;<br />
}<br />
//Into step2()
<br />
dwWaitResult=WaitForSingleObject(Semaphore,INFINITE);<br />
<br />
while (dwWaitResult==WAIT_TIMEOUT)<br />
{<br />
};<br />
If anyone can help me, that would be great, thanks!
Paolo
|
|
|
|
|
I take it you mean each step is running on its own thread?
Semaphores dont help you gaurentee order. All the do is protect say thread A accessing the same thing as thread B. Which order thread A and thread B run in is down to the scheduler. So it might happen A grabs the semaphore, B tries to and waits, A releases semaphore, B contnues to run. Or it might happen B grabs the semaphore, A tries to and waits, B releases semaphore, A contnues to run - its up to the scheduler (and of course your theads priority).
If you want things to happen one after the other, run them on the same thread:
void Foo(
{
Step1();
Step2();
Step3();
}
etc.
If you really want each step to happen on it's own thread, then you need to use events. Look up CreateEvent/SetEvent/ResetEvent
If I have the wrong end of the stick, and what you are asking is you want ShellExecuteEx not to return until the spawned process has finished, you do it like this.
SHELLEXECUTEINFO si;
si.fMask = SEE_MASK_NOCLOSEPROCESS;
si.etc etc
ShellExecuteEx(&si);
WaitForSingleObject(si.hProcess, INFINATE);
|
|
|
|
|
Hello!
please help me in this field.
when I run this program in visual C++ (6.0) this link error appears:
error LNK2001: unresolved external symbol _WMCreateEditor@4
Debug/main.exe : fatal error LNK1120: 1 unresolved externals
this program put marker on sound file
thank you for reply.
(I'm sorry.I could not speak English perfectly)
#######################################################
IWMMetadataEditor *pEdit = 0;
IWMHeaderInfo *pInfo = 0;
// Create the metadata editor object.
WMCreateEditor(&pEdit);
pEdit->Open(L"C:\\example.wmv");
pEdit->QueryInterface(IID_IWMHeaderInfo, reinterpret_cast<void**>(pInfo));
// Add the markers. Note that we add the last ones first. Do this when possible
// for improved performance when writing the markers to the file.
hr = pInfo->AddMarker(L"End", 520000000); // 52 sec.
hr = pInfo->AddMarker(L"Segue", 350000000); // 35 sec.
hr = pInfo->AddMarker(L"Intro", 15000000); // 1.5 sec.
// Commit changes and clean up.
pEdit->Flush();
pEdit->Close();
pInfo->Release();
pEdit->Release();
|
|
|
|
|
have you checked if all .lib files are included into the project? or check if prototypes of WMCreateEditor is declared correctly
Paolo
|
|
|
|
|
1. either link in the "wmvcore.lib" into your project settings (link tab)
or
2. add this to your source or into "stdafx.h"
#pragma commend(lib, "wmvcore.lib")
or
3. directly add the lib into your project as one of the files
|
|
|
|
|
Hi,
I have an app with a series on property pages in a row. I was wondering if there was a fancy way that it could dock on the left hand side on the screen tucked away and the subsequent clicks would bring it out to the middle of the screen and vice versa.
I think I have seen something like this some where but can't remember where.
Does any one have a small sample link to such a thing?
|
|
|
|
|
Hello,
I'm writing a GUI to simplify the use of a console-based application, I've created a WIN32 application ( no MFC or ALT), I want to know if it's possible to print the output from dos console to an HWND that it's related to a listbox control;for opening the dos-console program I've used the ShellExecuteEx function.
thanks
Paolo
|
|
|
|
|
There is one article in Codeproject which also redirect stdin, stdout and stderr handles to a window.
Check this out.
http://www.codeproject.com/dialog/quickwin.asp
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
See these two articles:
http://support.microsoft.com/default.aspx?scid=kb;en-us;190351
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_a_child_process_with_redirected_input_and_output.asp
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi there,
Does anyone have an idea of how to go about using Constrained Delaunay Triangulation in Line thinning? The input is a black and white TIFF image, pixel based. The program should thin the lines of the image to one pixel width.
Would really appreciate help here!
regards, fuzzypeach
|
|
|
|
|
Hi,
Now I'm using IHTMLDocument2::write to write html contents to an HTML document. But I found it become slower and slower after many times of writes, even I wrote in the same html contents every time. I dont know why
Below is the sample codes:
IHTMLDocumentPtr doc;
if(FAILED(doc.CreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER)))
return;
CComQIPtr<IHTMLDocument2> doc2 = doc;
if(doc2 == NULL)
return;
time_t startTime, ltime, delta = 0;
int step = 200;
for (int i = 1; i <= 50000; i++)
{
time(& startTime);
if(FAILED(doc2->write(sfArray)))
break;
doc2->close();
time(& ltime);
delta += ltime - startTime;
if (i % step == 0)
{
TRACE (_T("Seconds used on loading %d html DOM from %dth with same doc: %ld\n"), step, i - step, delta);
delta = 0;
}
}
I also write a demo project to demonstrate this but cant attach it here. If you need it, I'll send it to you.
Thanks & regards,
Hailiang
|
|
|
|
|