|
How about a code snippet for us to look at?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I got it the problem was with the flag
DWORD Level = 2;
PRINTER_INFO_2 *printerInfo = 0;<br />
<br />
DWORD numElems = 100;<br />
DWORD sizeBuff = 0;<br />
<br />
DWORD Flags = PRINTER_ENUM_CONNECTIONS | PRINTER_ENUM_LOCAL;
LPTSTR Name = NULL;<br />
<br />
DWORD sizeNeeded;
DWORD numReturned;
<br />
printerInfo = new PRINTER_INFO_2[numElems];<br />
sizeBuff = numElems * sizeof(PRINTER_INFO_2);<br />
<br />
BOOL qry = EnumPrinters(<br />
Flags,
Name,
Level,
(unsigned char*)printerInfo,
sizeBuff,
&sizeNeeded,
&numReturned
);
|
|
|
|
|
If you want to use PRINTER_ENUM_NETWORK , you'll need to set Level equal to 1.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Right, that was the mistake.
|
|
|
|
|
Dear friends,
Please tell me what data structure is suitable in my situation.
I am getting list of directories from FTP server. I need to keep information about each directory in that data structure in such a manner that later i can iterate through that data structure and know that who is child and who is parent.
Please tell me what data structure should i use. Or do i need to make my own ?
Imtiaz
|
|
|
|
|
A tree?
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Depending on how you are going to access the items, an array or list will both suffice. The former allows access to any item, while the latter requires you to iterate items from the beginning.
The item stored in either could look something like:
struct _FolderInfo
{
CString strFolder;
CString strParent;
};
CArray<_FolderInfo, _FolderInfo&> arrFolderInfo;
CList<_FolderInfo, _FolderInfo&> listFolderInfo; Having shown all that, a question that comes to mind is why store the name of the parent folder? If the absolute name of the folder is being stored, then the parent is known by simply removing the rightmost folder. Yes?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Actually my situation is just like that of windows registry, each node has children and each children can have more children. Any idea what data structure maintained by registry ??
Imtiaz
|
|
|
|
|
Imtiaz Murtaza wrote:
Any idea what data structure maintained by registry ??
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I use both Visual Studio 6 and 7. I want to detect and use dual monitors. For this I use GetSystemMetrics(SM_CXVIRTUALSCREEN), which works fine under vs7. Under vs6 SM_CXVIRTUALSCREEN is unknown and it returns zero (after putting in the integer value of the constant).
Apparently one way to solve the problem is with the SDK. I would like to know if there is a lighter weight option? Also if I give the software to a friend, does he too need the SDK?
My gut feeling is there must be an easier solution.
Any suggestions?
Thanks,
Ilan
|
|
|
|
|
If you want to detect multiple monitors acting in/as a virtual screen, you might want to use SM_CMONITORS . Note that that value, as well as the SM_C?VIRTUALSCREEN values are dependent on the OS your application is running on; they will return an incorrect value (0 ) on Windows 95 and Windows NT.
The updated SDK only gives you the files required to compile and link your code that uses the updated/new identifiers, it does not guarantee that the resulting application will work on any OS.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Thanks Jim,
I am using SM_MONITORS and that doesn't work either.
The OS is XP so that is no problem but it returns zero.
Can you explain this??
Ilan
|
|
|
|
|
Nope, I cannot explain that. You do not have any of the Application Compatability settings turned on for your app, do you?
Look into EnumDisplayMonitors and see if that works for you.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Jim shalom,
Thanks for your trouble to answer my question. This morning I finally solved the mystery. I've got 2 different machines, one with 2 monitors and vs7 and the second with 1 monitor and vs6. (Change 2 variables at the same time and you've got problems.) The documentation about the SDK managed to confuse me as well.
Yesterday I went and looked with the debugger in assembly mode at the 2 monitor system. I saw it went into user32.dll with the integer value. Clearly user32.dll depends only on the operating system and has no connection to vs6 or vs7 (or any SDK for that matter).
Thus I manually defined SM_C?VIRTUALSCREEN and SM_MONITORS for vs6 only. Now I call SM_C?VIRTUALSCREEN if and only if SM_MONITORS returns > 1. I initially expected SM_C?VIRTUALSCREEN to return the same value as SM_C?SCREEN (the bounding rectangle of 1 screen), but this is a mistake and it returns zero for 1 monitor. Thus I have to complicate my code a bit and use:
if( GetSystemMetrics( SM_CMONITORS) > 1) {
m_screen.x = GetSystemMetrics( SM_CXVIRTUALSCREEN);
m_screen.y = GetSystemMetrics( SM_CYVIRTUALSCREEN);
}
else {
m_screen.x = GetSystemMetrics( SM_CXSCREEN);
m_screen.y = GetSystemMetrics( SM_CYSCREEN);
}
The bottom line is that it works and I don't need the SDK. It is still operating system dependent, but if I want 2 monitors, that is the price.
Thanks again for your help.
Shalom,
Ilan
|
|
|
|
|
Try the following codes:
CRect rectFrame, rectView, rectChild, rcScreen;
MONITORINFO mi;
mi.cbSize = sizeof (MONITORINFO);
if (GetMonitorInfo (MonitorFromPoint (CPoint(0,0), MONITOR_DEFAULTTONEAREST),
&mi))
{
rcScreen = mi.rcMonitor;
}
else
{
::SystemParametersInfo (SPI_GETWORKAREA, 0, &rcScreen, 0);
}
......
Jack
---------------------------------------------------------------------------------
XD++ MFC/C++ Flow/Diagram Library -- http://www.ucancode.net
|
|
|
|
|
Don't forget to include the following codes:
#ifdef _AFXDLL
#define COMPILE_MULTIMON_STUBS
#endif // _AFXDLL
#include "multimon.h"
#pragma warning (default : 4706)
Jack
---------------------------------------------------------------------------------
XD++ MFC/C++ Flow/Diagram Library -- http://www.ucancode.net
|
|
|
|
|
Hi,
I am working on a project on QT and VC++. I need to know after I build the *.dsp and edit the code in VC++, I need to view the members of a certain class. The intellisense refuses to work in this case. I try the Ctrl+T, Ctrl+Atl+space, or even right-click and on the context menu click on List Members. None of this seems to work. Any ideas.
Help greatly appreciated
|
|
|
|
|
Must you use Intellisense? Why not just open the class' .h file? Have you tried deleting the project's .ncb file?
Sitaram Sukumar wrote:
I try the Ctrl+T, Ctrl+Atl+space...
The key combination is Ctrl+Alt+T.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Try the following steps:
1.Choose "Insert project to workspace" menu item to insert QT project file to your own project.
2.Then click "File|Save Workspace".
3.Then delete QT project from your project.
Now the intellisense will works.
Jack
---------------------------------------------------------------------------------
XD++ MFC/C++ Flow/Diagram Library -- http://www.ucancode.net
|
|
|
|
|
how do i make the column width in a CListCtrl (report view) fixed (that is not changable by the user!) ?????i want the width fixed!!!!!
cheers.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
This is what I used in the past, don't know if there's an updated method:
Prevent column resizing
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
aaaaww......thank u guyz.....itz just what i wanted!!!!!......thank u jack and David!.....
cheers.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
Handle the HDN_BEGINTRACK notification in the header control's OnChildNotify() method. You'll notice that the resize arrow still shows up. To handle this, override the header control's OnSetCursor() method and return
TRUE.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi Folks!
I have got a problem hope you people will definately help me..
The problem is i want to display a Grid on screen (MFC App Wizard Application), i did the following
i.e. Draw severel Rectangles to
accomplish the grid like look.
The rectangls are drawn with white 'in' and black 'outer boundry'
[code]
void CSimulationView::OnDraw(CDC* pDC)
{
//Display Squares of width and height 40x40
int x1 = 0 ;
int y1= 0;
for(int i=0; i < 12; i++ )
{
for(int j=0; j < 19; j++ )
{
pDC->Rectangle(x1,y1,x1+40,y1+40);
x1+=40;
}
x1=0;
y1+=40;
}
}
[/code]
The question is how i can change the color of, in of the rectangle and outer boundry(say in color is red and outer boundry color is cyan).
One thing more how to fix the size of my display window.i.e. i want my display window to be 700 pixels wide and 500 pixel high,i.e. user can only minimize or see the window in (700,500) size, he can not resize the display windows..
Hope you prople will sort out my problem..
Reagards, Jinbaba
|
|
|
|
|
jinbabaj wrote:
The question is how i can change the color of, in of the rectangle and outer boundry(say in color is red and outer boundry color is cyan).
The outline is drawn with the current pen, and the inside is filled with the current brush, so to change the colours, select a different pen and brush into the device context using SelectObject().
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|