|
Okay.. I just talked to a guy, who told me that I shouldn't be using CScrollView, because it behaves differently from other views. And true enough. When I switched to a standard CView, SetScrollPos didn't scroll my window anymore. I think that's werid.
|
|
|
|
|
i want to get the information and icon of shortcut of desktop by selecting with mouse. i get the list view of desktop shortcut and also i can get the selected index number of shortcut. i am using VC++6.0 and windows 2000 professional. "what i want is to get the icon image and icon name and shortcut link file name". the following code i am using. Mouse hooking is not needed.
HWND hWnd = ::FindWindow("Progman", NULL);
if (NULL != hWnd)
hWnd = FindWindowEx(hWnd, NULL, "SHELLDLL_DefView", NULL);
if (NULL != hWnd)
hWnd = FindWindowEx(hWnd, NULL, "SysListView32", NULL);
if (NULL != hWnd)
{
UINT count = ListView_GetSelectedCount(
hWnd
);
INT mark = ListView_GetSelectionMark(
hWnd
);
int nItem = ListView_GetItemCount(
hWnd
);
... ... ...
}
|
|
|
|
|
Ok, so is your code working? If not, what errors are you getting (e.g., compiler, linker, runtime)? Is the value of count , mark , and nItem correct?
Have you considered SHGetFolderPath() with either CSIDL_COMMON_DESKTOPDIRECTORY or CSIDL_DESKTOPDIRECTORY ? With the path, you can then use FindFirstFile() and FindNextFile() to "find" each file in the folder. Then you can use ExtractIcon() to get the icon used by the file.
I've not tried this specifically, so your mileage may vary.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
1-i want to notify to user when
a program try to access to internet do you think
is there any event in .net or in windows for this
purpose and if there is which events
2- i want to see all open ports in mycompuetr
somthing like netstat command in windows but iwant
do this programmatically
3-if i saw a port is open how can i close it
programmatically
koosha
|
|
|
|
|
Dear all,
I get a following linking error....I am working on VS.NET...can n e one tell why thi occurs and how can it be eliminated....
HanimCompute.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class MString const &)" (__imp_??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABVMString@@@Z) referenced in function "public: virtual class MStatus __thiscall snMHanimator4Node::compute(class MPlug const &,class MDataBlock &)" (?compute@snMHanimator4Node@@UAE?AVMStatus@@ABVMPlug@@AAVMDataBlock@@@Z)
HanimNode.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class MString const &)" (__imp_??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABVMString@@@Z)
Thanks,
Raj
|
|
|
|
|
Which is currently the fastest method to read a text file into memory.
I am using ifstream and get and would like to know of anything better.
|
|
|
|
|
Are you doing ifstream::read()?
What is the length of the data block you are reading? Try increasing the size of the chunks you read if it's reading too slowly. Reading 1 byte at a time is incredibly slow but reading 1MB at a time will be really fast.
|
|
|
|
|
The length of the data block is the entire filesize (which varies)...in my case it is around 500K at the moment...the entire file is read w/ one get.
It is not that slow, I just thought there may be a faster way.
|
|
|
|
|
I have experimented with this now and again and always found that blocks of 2,4 and 8k ranges provide the best performance. I have always assumed that there must be variants across systems that might effect this. OS, File System, Disk Drive and probably more.
It is relatively simple to create a console app that allows you to test variations.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
What are you doing with the file? Memory mapped files deliver impressive performance and may be suitable for your task.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Hmmmm!
1) Open file.
2) Get size of file.
3) Allocate enough memory to hold entire file.
4) Read file into buffer.
Of cource this only applies if file size if smaller than the maximum buffer size that you can allocate. Under Win32, you can allocate very very large buffers.
INTP
|
|
|
|
|
Yep, that's exactly what I did, just making sure it's the fastest way.
Thanks for the help.
|
|
|
|
|
Sir,
THis is my first application with hooks.
I amtrying to register WH_KEYBOARD hook for my app so that when ever I tried to make Caps tab on this will set to off.
So I placed a gloabl variable of HHOKDATA and a glabal proc -KeyboardProc.
I placed these globally in CMainFrm.cpp
I registered this hook using using SetWindowsHookEx and called in OnCreate of CMainfrm.cpp.
But this is not getting called and let me know what to do so that this hook should call .
Should I map the events ????
But hooks will getcalled only before the event is passed to WndProc?
Pls correct me if I am wrong.
Where I am going wrong?
|
|
|
|
|
blacktiger007 wrote:
I registered this hook using using SetWindowsHookEx and called in OnCreate of CMainfrm.cpp.
But this is not getting called and let me know what to do so that this hook should call .
What is not being called? SetWindowsHookEx or the hook you are trying to install?
blacktiger007 wrote:
But hooks will getcalled only before the event is passed to WndProc?
Hooks are called before the window message is delivered to a message pump.
If you are trying to install a global hook, please note the section in the MSDN docs: The global hooks are a shared resource, and installing one affects all applications in the same desktop as the calling thread. All global hook functions must be in libraries. Global hooks should be restricted to special-purpose applications or to use as a development aid during application debugging. Libraries that no longer need a hook should remove its hook procedure.
Are you installing a global hook? If so, do you really need the global hook? If you are installing a global hook and you really need it, there's this[^] article.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
I called a global hook and wrote the code in CMainFrm.cpp fie and called SetWindowsHookEx in OnCreate of CMainFrm.
I wrote the code KeyboardProc here.
When I tried to debug it ,The actual KeyboardProc deined in this file is not geting called.
Pls solve this as I will extend this app using DLLs later.
|
|
|
|
|
I'll recite the MSDN docs again: All global hook functions must be in libraries.
Those are the rules. Period.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
sir why not use a dll to set the hooks and put the callback function there.
The virtual keycodes for capslock and tab are:
VK_CAPITAL 14(value hexadecimal) CAPS LOCK key
VK_TAB 09(value hexadecimal) TAB key
So in your callback function you'll have to monitor whenever these key are pressed and when they are pressed instead of returning 0 (as success) return 1 (as error).
And there you are
gabby
|
|
|
|
|
Sir,
Thx for the response.
This is the code for a global hook which I defined in MainFrm.cpp
But even without using a dll this should get fired after registering the hook by calling SetWindowsHookEx in OnCreate of CMainFrm
Pls correct me if I m wrong .
LRESULT CALLBACK KeyboardProc(int code,WPARAM w,LPARAM l)
{
if (code < 0)
return CallNextHookEx(m_hookData,code,w,l);
unsigned char state[256];
if( w == VK_CAPITAL)
{
GetKeyboardState(state);
if(state[VK_CAPITAL] == 1)
{
state[VK_CAPITAL] =0;
SetKeyboardState(state);
}
}
return CallNextHookEx(m_hookData,code,w,l);
}
|
|
|
|
|
first ,your must read this article and learn his technology.
http://www.codetools.com/internet/winsockiocp.asp?df=100&forumid=2079&select=861727
because i used his code in my project,the server-exe file works fine in win2000 server os,but under windows xp or windows 2003 server os ,the server-exe file works fail! i used port 5000 in the CIOCPServer intialize function. under 2000 server os,when the server-exe file execute ,use system command netstat -a ,i can see port 5000 is opened.but when the server-exe file execute in windows xp or windows 2003 server os, use the system command netstat -a ,there isn't port 5000.client-exe is failed during connecting. i expect for your help.thanks a lot.
|
|
|
|
|
It is not easy to debug this IOCP issue as you are using some arbitrary IOCP I/O wrapper class. Is the XP system configured correctly?
Kuphryn
|
|
|
|
|
Is the wsaasynSelct() function limited under windows xp or windows 2003? the configuration is default of system. i
don't limit any port.
|
|
|
|
|
I have created a few procedures in assembly that I want to be C++ callable. I also want to be able to give arguments.
I am using Masm as my assembler and Visual C++ as my compiler.
I already know that I need to append a _ to my functions. I also seem to remember poping things off the stack for parameters, but I don't know for sure.
An example is a procedure:
_Out
I want it to take a byte as one parameter and a word as the next, and then I want to be able to call it from a C++ program that it is somehow linked to. (I don't know how to do that either)
How would I go about doing this?
Thanks
|
|
|
|
|
Is bringing your assembler code to a CPP file an option ?
here's an example, even with a return value
word Out(char p1, word p2)
{
word param;
_asm
{
mov ah, p1
mov cx, p2
..
..
mov param, cx
}
return param;
};
Hope it helps,
DarkByte
|
|
|
|
|
I'm working on a Win32 (actually, Qt) app, and would like to use the alt key to modify some keyboard/mouse buttons. It's working great, except that pressing the alt key moves the keyboard focus to the menu (like it normally should). How can I disable/avoid that? Most importantly, is there a simple solution, without having to manually process messages?
Thanks!
|
|
|
|
|
I don't think there's an easy solution. Especially not so with Qt, as it probably hides the message pump from you.
I tried this in MFC:
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if((pMsg->message == WM_SYSKEYDOWN || pMsg->message == WM_SYSKEYUP)
&& pMsg->wParam == VK_MENU) {
DoMything();
return TRUE;
}
return CFrameWnd::PreTranslateMessage(pMsg);
} and it worked fairly well I believe. It didn't mess with the accelerators (ALT-F for File Menu, ALT-F4 for close application, etc), but it allowed me to do whatever I want to with the ALT-button. In this case I'm just filtering it out. If it's possible to implement a PreTranslateMessage() function in Qt, it's not a hard problem.
Good luck.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|