|
Manjunath S wrote: How to generate IDOK message using Sendmessage
Can you specify your need little more in detail.
If the Dialog is showed using DoModal() then use EndDialog() to close the dialog and you can specify the return value...
Do your Duty and Don't expect the Result
|
|
|
|
|
As far as I perceive your query, you are trying to automatically close a dialog after some task is done and for this you want to fire a IDOK message.
Am I right?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
HI
In My application I have a dialog which has two edit box(for getting username and password) and a button(ok).
So what i need is to fill the default username and password in the editbox and generate Ok notification automatically so user can logon automatically without pressing anything ...
Manjunath S
GESL
Bangalore
|
|
|
|
|
Is there any problem with , what Stephen Hewitt has suggested ?
|
|
|
|
|
if you want to let the user login automatically why do you need a login dialog.Just let the user access the application's functionality
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi,
Im searching for a calue in a listcontrol by using this
LVFINDINFO info;
int nIndex;
LPCTSTR lpszmyString ="LogFile";
info.flags = LVFI_PARTIAL|LVFI_STRING;
info.psz = lpszmyString;
if ((nIndex=pCtrl->FindItem(&info)) != -1)
{
Index = pCtrl->InsertItem(nIndex,Sno);
}
But here nIndex always returns -1, i want to serach for "LogFile" in listcontrol.Whats wrong with this?
Anu
|
|
|
|
|
Are you sure , thers is an item, having label "LogFile" or which starts with "LogFile".
Otherwise there is no reason, it shouldn't work
Anu_Bala wrote: Index = pCtrl->InsertItem(nIndex,Sno);
what you are doing here ? whats Sno.
|
|
|
|
|
Yes, it has..My list control shows likethis
-----------------------------------------
1 LogFile User1 ModelDT002
Anu
|
|
|
|
|
Anu_Bala wrote: 1 LogFile User1 ModelDT002
MSDN description of flag
LVFI_PARTIAL :-Matches if the item text begins with the string pointed to by the psz member. This value implies use of LVFI_STRING.
In your case Item text begins with 1. Thats the problem.
|
|
|
|
|
So, how can i search the second item that is "logfile" i have to find that only.
Anu
|
|
|
|
|
See if its good for you(without create editbox because you dont need to it, find in list)
<br />
USES_CONVERSION;<br />
CEdit m_Edit;<br />
CString str22;<br />
TCHAR buffer[100];<br />
LVFINDINFO find1={0};<br />
<br />
m_Ctrl1.InsertItem(0,"test");<br />
m_Ctrl1.InsertItem(1,"test1");<br />
m_Ctrl1.InsertItem(0,"a"); <br />
m_Ctrl1.InsertItem(0,"b"); <br />
m_Ctrl1.InsertItem(0,"test"); <br />
m_Ctrl1.InsertItem(0,"a1"); <br />
m_Ctrl1.InsertItem(0,"b1"); <br />
m_Ctrl1.InsertItem(0,"test"); <br />
<br />
m_Edit.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);<br />
m_Edit.SetWindowText("test");<br />
m_Edit.GetWindowText(str22);<br />
int index=-1;<br />
<br />
<br />
find1.psz = str22;<br />
find1.flags = LVFI_STRING;<br />
do<br />
{<br />
index=m_Ctrl1.FindItem(&find1,index);<br />
MessageBox(itoa(index,buffer,10));<br />
<br />
}while(index!=-1);<br />
and see this thread[^]
|
|
|
|
|
my coding is
if(Fname =="LogFile")
{
///////////anu
LVFINDINFO info={0};
int nIndex ;
int nstart = -1;
LPCTSTR lpszmyString ="LogFile";
info.flags = LVFI_STRING;
info.psz = lpszmyString;
if ((nIndex=pCtrl->FindItem(&info,nstart)) != -1)
{
Index = pCtrl->InsertItem(nIndex,Sno);
pCtrl->SetItemText(Index,1,Fname);
pCtrl->SetItemText(Index,2,Instr);
pCtrl->SetItemText(Index,3,Traine);
pCtrl->SetItemText(Index,4,ModelName);
pCtrl->SetItemText(Index,5,Model);
// pCtrl->SetItemText(Index,5,Modeltwo);
cnt=1;
sno+=1;
newsno=sno;
}
}
else
{ /////anu
Index=pCtrl->InsertItem(RowIndex,Sno);
pCtrl->SetItemText(Index,1,Fname);
pCtrl->SetItemText(Index,2,Instr);
pCtrl->SetItemText(Index,3,Traine);
pCtrl->SetItemText(Index,4,ModelName);
pCtrl->SetItemText(Index,5,Model);
// pCtrl->SetItemText(Index,5,Modeltwo);
cnt=1;
sno+=1;
newsno=sno;
}
}
Anu
|
|
|
|
|
Did you see my code it doesnt work did you see that link and alos you can see a example in msdn
|
|
|
|
|
LVFINDINFO info;
int nIndex;
CString buffer;
CString lpszmyString = "LogFile";
int subItem = 2; // or which ever column you want
int itemCnt = pCtrl->GetItemCount();
for(int x = 0; x < itemCnt; x++)
{
buffer = pCtrl->GetItemText(x,subItem);
if(buffer == lpszmyString)
{
Index = pCtrl->InsertItem(x,Sno);
// note:
/*
This doesn't actually remove this item
by inserting an item at the index, all items below the index are pushed down;
I think what you want is:
pCtrl->SetItemText(x,0,Sno);
*/
}
}
|
|
|
|
|
can anyone please help me in reading the font bitmap info of a specific character
from the TTF font file?
I need to get the bitmap bytes for a given character from the font ttf file
so that i can use that bitmap to paint the same on the screen.
Thank you in advance.
|
|
|
|
|
Why?
Wouldn't it be easier to generate output using a memory DC into a bitmap using standard text functions?
If you needed to save the generated bitmap, you could.
Steve S
Developer for hire
|
|
|
|
|
Hi,
Thank you for the reply.
I am new to this windows stuff and i really don't know the simple way to do.
just thought we might have to read it from font file .
The only thing i am interested is the bitmap created due to that character.
Please help me by mentioning how do we do that from memory DC etc..
Thank you.
|
|
|
|
|
Well, often you don't need to do anything other than use CreateFont or CreateFontIndirect, then select that font into a DC before using any of the text output functions. Controls generally support being sent a WM_SETFONT message so that they use the correct font themselves.
To retrieve the bitmap of a font character isn't difficult, but there are limitations.
1. Create the font (use CreateFont or CreateFontIndirect).
2. Select the font into a screen DC
3. Use GetTextExtent to find out how big a bitmap you need for your text.
4. Deselect the font from the screen DC
5. Create a compatible (with the screen DC) DC - your memory DC
6. Create an appropriately sized compatible bitmap (compatible with the screen DC, not the memory DC), and select it into your memory DC.
7. Set a background colour for the memory DC
8. Set a text colour for the memory DC.
9. Select your font into the memory DC.
10. Output your text
--- You now have the bitmap
11. CLEAN UP!
Deselect the font from memory DC and delete it
Deselect bitmap from memory DC and delete it
Delete memory DC
12. Don't forget to release the screen DC you got in stage#2.
There, that was easy, wasn't it ?
Unless you're saving the bitmaps, like I say, you just need to create and select the font you need, before drawing text, in which case, most of the work is done for you
Steve S
Developer for hire
|
|
|
|
|
Thanks for your help, i could get the data.
but still held up with another issue
I am trying to get the font from the present foreground window
like notepad. but always i get the font as system only.
How do i get the device context of the client window in a windows (lets say in notepad).
i hope "GetDCEx" is the function that gets the Client DC, but i could figure out
how it works
Can anyone please help me to find the DC of the client window so that i can get the
font used by it by using "GetTextFace" function.
Thank you.
|
|
|
|
|
Given an HWND, GetDC(hWnd) will return the DC for the client window.
Steve S
Developer for hire
|
|
|
|
|
hi i m using setwindows hook functin with low level keyboard as paramter. in application it works fine and capture all global keystrokes but it is not working in service call back function is not called.i m calling setting hooks from servicemain function without the thread and hook is setted does not return null.
my service is interactive service it means it listen the windows events.
-- modified at 3:22 Tuesday 22nd August, 2006
Tasleem Arif
|
|
|
|
|
From MSDN on the SetWindowsHookEx API:
"These events are associated either with a specific thread or with all threads in the same desktop as the calling thread."
I have underlined the relevant part.
If you want a service to "interact with desktop" I would first investigate the "Allow service to interact with desktop" checkbox in the services properties.
Steve
|
|
|
|
|
thanks for reply here is the code for the creating service i think it is interactive mean can access user input and desktop.
schService = CreateService(schSCManager,
TEXT(SZSERVICENAME),TEXT(SZSERVICEDISPLAYNAME),SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS ,SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,szPath, NULL,
NULL,TEXT(SZDEPENDENCIES),NULL,NULL);
and for the hooks
hHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowerLevelKeyboardProc, hInstance,0);
if(hHook==NULL)
printf("SetHooks failed\n");
if i associate it with the specific thread will that thread will be called itslef regardless when created through createthread and once executed.
i will be very thankful to you if you provide me any further info.Thanks
If you want a service to "interact with desktop" I would first investigate the "Allow service to interact with desktop" checkbox in the services properties. services dont have such property i m using vc++.
-- modified at 4:32 Tuesday 22nd August, 2006
Tasleem Arif
|
|
|
|
|
I am assuming your hInstance is the instance of a DLL you loaded that contains the hook procedure as an exported function? Otherwise, this will not work.
The 'global' hook procedure can not be in your service EXE file, it must be in a DLL your service loads dynamically.
Try using LoadLibrary and GetProcAddress to make it work.
SetWindowsHookEx(WH_KEYBOARD_LL, LowerLevelKeyboardProc, hInstance,0);
It does not make sense to load a local keyboard hook in your service, since the service will never have 'focus' under 'normal' circumstances.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
i m using the MFC extension dll and its callback function def like this and
works well from the desktop application.
LRESULT __declspec(dllexport)__stdcall CALLBACK KeyboardProc(int <br />
<br />
nCode,WPARAM wParam,LPARAM lParam) i m using this function to from
service to call th dll which also works for the desktop application.
typedef BOOL (CALLBACK *inshook)(); <br />
inshook instkbhook;<br />
hInstance= LoadLibrary((LPCTSTR) "hodll.dll"); <br />
instkbhook =GetProcAddress(hInstance, "installhook"); <br />
instkbhook();
i had googled a lot to find any example that uses callback or hook but was
not successful.dont know what to do or how to solve.My service is also
allowed to interact with desktop.
Tasleem Arif
|
|
|
|
|