|
Is there a way to do this in Windows without .neT?
Thanks!
|
|
|
|
|
BOOL CreateDirectory(
LPCTSTR lpPathName, // pointer to directory path string
LPSECURITY_ATTRIBUTES lpSecurityAttributes // pointer to security descriptor
);
BOOL RemoveDirectory(
LPCTSTR lpPathName // pointer to directory to remove
);
|
|
|
|
|
|
hi,
i have 2 variables like
char * username
char sysname[MAX_PATH]
i need to use "NetUserGetInfo" windows API method, which takes two LPCWSTR strings, how can i convert the above sysname,username to pass them to NetUserGetInfo.
thanks
|
|
|
|
|
Use A2W string conversion macro.
void func( LPSTR lpsz )
{
USES_CONVERSION;
...
LPWSTR x = A2W(lpsz)
...
}
Nibu thomas
Software Developer
|
|
|
|
|
I need exactly the reverse way,
that is i have char* username, char sysname[max_PATH].
i need to pass these 2 variables to NetUserGetInfo(LPCWSTR,LPCWSTR)
thanks
|
|
|
|
|
gbabu17 wrote: I need exactly the reverse way,
that is i have char* username, char sysname[max_PATH].
i need to pass these 2 variables to NetUserGetInfo(LPCWSTR,LPCWSTR)
Nibu thomas
Software Developer
|
|
|
|
|
Life isn't easy, isn't ?
|
|
|
|
|
if your problem is NetUserGetInfo for conversition) use (or like this)
LPTSTR user;
LPTSTR computer;
user=(LPTSTR)LocalAlloc(LPTR,256);
computer=(LPTSTR)LocalAlloc(LPTR,256);
DWORD d=256;
GetUserName(user,&d);
DWORD dd=256;
GetComputerName(computer,&dd);
wchar_t *m_User = T2W(user);
wchar_t *m_computer = T2W(computer);
DWORD dwLevel = 4;
USER_INFO_2 *m_Userinfo;
DWORD dddd=NetUserGetInfo(m_computer, m_User , 2, (LPBYTE*)&m_Userinfo);
|
|
|
|
|
Which is what A2W() does. I've done it this way in the past:
LPUSER_INFO_2 pUserInfo = NULL;
CString strUser;
NET_API_STATUS nStatus = NetUserGetInfo(L"\\\\server", A2W(strUser), 2, (LPBYTE *) &pUserInfo);
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
I have faced this question in an interview,
Design algorithm for elevators using any design pattern.
please guide me regarding this.
krishna
|
|
|
|
|
Well I can give a brief description
When they go up they keep going up processing the requests on the way.
and
When they come down they keep coming down processing the requests on the way.
They don't change direction in between unless they have processed all requests in that direction
and
BTW if anybody gives another request before it changes direction it processes that too.
This is called the elevator algorithm.
Nibu thomas
Software Developer
|
|
|
|
|
hai,
can u elaborate this , just like what r the abstract base class we r designing for this and derived classes and some importnt methods.
|
|
|
|
|
Composite Pattern - For the structure, components and movement of the elevator (e.g. doors, switches, lightsource etc.).
Iterator Pattern - For the list of floors.
Observer Pattern - To identify on which floor to stop.
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|
Hi there!
I'm writing a server, which shold have an update function. So it should replace it's own executable file with a new version. Has any one an idea how to manage that?
Thank you!
|
|
|
|
|
if MyServer.exe is currently running, it won't be able to overwrite its own exe
What you'll need to do is something like this
in MyServer.exe
Check internet for update
if update available
{
download update package
launch Updater.exe
quit MyServer.exe (saving everything gracefully)
}
---
in Updater.exe
Wait for MyServer.exe to shut down
Depack update package
Launch updated Myserver.exe
quit Updater.exe
---
You might want to set this update process so that it can be scheduled at a quiet time for your server. E.g. if it's main traffic is from 9am - 5pm, then make it try to update at 5am
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
Now I do something about barcode, some barcode uses Fonts, some uses draw lines.
this post is not related to barcode, but it is caused from barcode.
a vertical line can be printed by 2 methods:
1. by font (such as character '|')
2. by drawing (such as LineTo())
as I tested, vertical line is printed much clearer by font than drawing for both laser and inkjet printers, do you know why?
important: do you know how to draw a line imitating vert line of font, which is much clearer than nomal LineTo()?
|
|
|
|
|
hi,
I am looking for way, how to copy text from Windows aplication to
MS-DOS. I just need to get simple text into DOS(window) -such Notepad
There is of course no clipboard support - I thought about simulate key strokes, but is it possible without writing device driver.
Any idea will help
Thanx
viliam
|
|
|
|
|
From within Windows right click on the MS-DOS icon and select "Properties". Select the "Options" tab. Tick the "QuickEdit mode" and "Insert mode" tick boxes. Press OK. Now you can right click in a DOS box to paste or select text with the left mouse button and right click to copy.
Steve
|
|
|
|
|
this works well but if I need to run program in fullscreen mode
it doesn't. Is there any trick to handle fullscreen?
(without taking it into windows and back)
viliam
|
|
|
|
|
I don't know how to make it work in fullscreen mode apart from by switching to windowed mode with ATL-ENTER, performing the operation then switching back.
Steve
|
|
|
|
|
I don't understand what you are trying to do. If you want to display text in a console application, why don't you use
cout<<"Text to be displayed";
Now, I don't understand what you mean by 'how to copy text from Windows aplication to MS-DOS'...
Could you be more specific ?
|
|
|
|
|
I have Win32 program with text data and I need to export
this text into dos applicatin
(I am not developer of this DOS program, I just want to save time
necessary to retype it from my program into DOS program)
Something like RE: above (with mouse)
but better programmely and in fullscreen mode as well.
viliam
|
|
|
|
|
Hi all,
I have an basic MDI application with a view class derived from CView. The view class has a string member(CString m_strTime) to get the system time in its constructor. I am displaying the sting in OnDraw. Now consider that I have opened three child windows.
I have a menu "Update" -> "Reset Time". I want to update all the child windows with the latest time. I am updating the latest time in Application class's member "strAppTime".
Pls look at the code:
CMyView::CMyView()<br />
{<br />
CTime t = CTime::GetCurrentTime();<br />
m_strTime = t.Format("%A, %B %d, %Y - %H:%M:%S") ;<br />
}<br />
<br />
<br />
CMyView::OnDraw(..)<br />
{<br />
CString strTime ;<br />
<br />
strTime = ((CMyApp*)AfxGetApp()) ->m_strAppTime ;<br />
<br />
if(strTime != "")<br />
pDC->TextOut(0, 0, strTime) ;<br />
else<br />
pDC->TextOut(0, 0, m_strTime) ;<br />
}<br />
<br />
<br />
void CMainFrame::ResetTime() <br />
{<br />
CMDIChildWnd *pChildWnd = MDIGetActive() ;<br />
if(!pChildWnd)<br />
return ;<br />
<br />
CTime t = CTime::GetCurrentTime();<br />
((CMyApp*)AfxGetApp()) ->m_strAppTime = <br />
t.Format("%A, %B %d, %Y - %H:%M:%S") ;<br />
<br />
pChildWnd->GetActiveDocument()->UpdateAllViews(NULL) ;<br />
<br />
}
It updates only the active child window. How to make possible for all the children. If I use MDIGetActive() and MDINext(), it changes the window order, as you know. It reflects clearly in Cascade arrangement.
Kindly suggest me a solution.
Thanks in advance,
Sarvan AL
|
|
|
|
|
You can create a Registered Message and send this message to all child windows using SendMessageToDescendants .
Make sure you send it to all immediate child windows only.
Have a message map entry in each child window for this message. Do updation there.
Nibu thomas
Software Developer
|
|
|
|