

InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
801. |
Solve : Batch to open a .pdf file? |
Answer» I'm WROTE a .bat file to open .pdf file. The problem is the .pdf file name is different everytime. So I was HOPING to write a .bat file that would open any .pdf in the folder. Is this possible?rick587.......why dont you D/L Adobe reader and forget about batch FILES ? |
|
802. |
Solve : Information logging Batch File? |
Answer» I'm trying to make a batch FILE that LOGS information at a prompt (in whicn you TYPE something LIKE name, age, whatever) and saves it to a .txt file. Anyone know how? thanks! "Brain" iac's way of BUMPING up his post count is to revive 3 year old threads. |
|
803. |
Solve : ejp,servlet and swing? |
Answer» hai, |
|
804. |
Solve : ejb,servlet and swing? |
Answer» HAI, I KNOW only basic java. I want to study ejb,servlet and swing. Can anybody guideme to study all these. What s/w i NEED to INSTALL and how to programe. Thank you No double posting, PLEASE. |
|
805. |
Solve : ejb,servlet and swing.? |
Answer» hai, |
|
806. |
Solve : fat file or ntfs?? |
Answer» which FILE should i use when reformatting my pc? FAT file or ntfs file and why? any suggestions? tnxI'm pretty sure you didn't google at all. |
|
807. |
Solve : new and delete? |
Answer» What does the NEw and delete operators do in c++... |
|
808. |
Solve : Frequencia Fuera de Bande? |
Answer» What does this mean when it APPEARS on your COMPUTER screen. |
|
809. |
Solve : puzzled? |
Answer» When I start up my computer I get a small box in the middle of the screen saying What language is your computer using? Are you in Spanish? Wouldn't that more likely mean that his video card is configured such that the monitor can't keep up with it? Refresh rate, perhaps? Horizontal and/or vertical sync, maybe? You're right; I totally forgot about that. Usually because I leave settings I don't fully understand alone (it works - don't touch it!), and while I sorta-understand refresh rate, it's not something I am 100% familiar with. Did you recently upgrade your video card or monitor, or CHANGE their settings?Quote from: Dilbert on July 09, 2007, 02:07:17 PM ....and while I sorta-understand refresh rate, it's not something I am 100% familiar with. I'm in the same BOAT - I too do not profess to know all the ins and outs of it. I believe it is a function of what the monitor is capable of, and also the video card. If the video card is capable of a higher rate than the monitor, then the user must use the lower rate - the monitor's. Quote Did you recently upgrade your video card or monitor, or change their settings? lachesis: Also, can you describe your monitor for us? Manufacturer name, model number, .... everything that identifies it. With that info, perhaps someone can find the correct settings for you. |
|
810. |
Solve : There must be a way!? |
Answer» I'm thinking about using a computer as a midi sound module. With a Sound Blaster card. I should be able to program a ROUTINE so that when I start the computer it will eventually open a program LIKE creative's keyboard and allow me to USE it without a keyboard or screen. The other option would be to not use the screen. THANKS! |
|
811. |
Solve : Visual Web Developer Create User? |
Answer» In Microsoft Visual Web Developer (using SQL and ASPX.NET) my "Create New User" form requires that the PASSWORD be 7 characters long, and contains at least ONE number. |
|
812. |
Solve : Qbasic and the CTRL+C command? |
Answer» Mmm, 1988 programming Documentation: Am not sure what the Documentation part of your response is all about but I might just get round to trying it one fine day. You didn't say what version of QBasic you are using but key combinations generally only allow for Gosub EXECUTION. You could call a sub from within the Gosub routine. Here is an example of CTRL+H but note this executes only when Capslock, Numlock and Shift are Off.. Code: [Select]CLS KEY 18, CHR$(&H4) + CHR$(&H23) ' user defined key within range 15 - 25 KEY(18) ON: ON KEY(18) GOSUB 40 do ' simplest of loops to KEEP prog running loop ' until the Ctrl+h combination is pressed 40 SHELL "type c:\windows\system32\eula.txt" ' test END RETURN CHR$(&H4) is the Keyboard Flag for CTRL and CHR$(&H23) is the Scancode for the letter H. The example has been tested using QB ver 4.5, no warranties given. Good luck Okay, thanks, Dusty I have the newest version of Qbasic (1988... really new...) So all should work well |
|
813. |
Solve : need help SAP 2 and SAP 3 Architecture plssss. help me? |
Answer» PLEASE help me i need a SAP 2 and SAP 3 ARCHITECTURAL design | |
814. |
Solve : netbean IDE 5.5 display error tail "0000"? |
Answer» init000 |
|
815. |
Solve : Q-How Do I Decrease the Number of Programs Running in Background?? |
Answer» How do I decrease the number of programs running in the background when I start-up the computer? I remember something about typing in Run: "config" and un-clicking the programs I do not WANT to run when starting the computer. I have XP. Thank you! My email is [REMOVED to avoid spam]What you're THINKING of is Start > Run > msconfig |
|
816. |
Solve : add-in manager vb 2005 express? |
Answer» can ANYONE TELL me how to TRIGGER "add-in manager"on the menu bar. I SEEMS to be missing in the 2005 EXPRESS edition. |
|
817. |
Solve : NEED DOS help? |
Answer» Windows XP operating system. |
|
818. |
Solve : I'm need professional program for website advertising? |
Answer» Anybody can recomend me links to purchase private SOFTWARE for advertising internet-projects? |
|
819. |
Solve : server but the file is missing? |
Answer» i am working on a server for an multiplayer online game... LOLZ... but the file called MSWINSCK.OCX i have the file here and everything but it doesnt work for some REASON. i dont know what i did lol.do you get a MESSAGE? |
|
820. |
Solve : flash drive batch file help? |
Answer» i want to use a batch file to run programs off of my flash DRIVE but don't want to change the drive letter every time i plug it into a computer. I've attached what i have so far. I think i posted this in the right forum so i put %~d instead of F:\ or G:\If I remember correctly then yes (otherwise it is a problem with a variable). i got it, thank youif its ok to messup the path env at the BEGINNING of the batch file Code: [Select]@echo off cls set PATH=%path%;A:\;B:\;C:\;D:\;E:\;F:\;G:\;H:\;i:\J:\;H:\:L:\ set /p A=what do you want to do: IF '%A%' == 'pstart' GOTO pstart IF '%A%' == 'ghost' GOTO ghost IF '%A%' == 'internet' GOTO internet exit :pstart "\USB Toolkit\PStart\PStart.exe" pause :ghost "\GhostzillaCD-1.0.1-free-v1\program\Start-Ghostzilla-CD.exe" pause :internet "\USB Toolkit\Tools\Internet\PortableFirefox\FirefoxPortable.exe" pause [/coe] |
|
821. |
Solve : program idea? |
Answer» i had this idea a while ago and tryed to do it by hand and was exhausting i WOULD like to make a program that would make a BUNCH of folders like a 4-digit combination lock so there would be folders with numbers 1-9 and in each folder folders 1-9 and so on im kinda new at PROGRAMING so some TIPS would be helpful PHP can do this. You'll need a server though. |
|
822. |
Solve : inf programming? |
Answer» IVE probably put this in the wrong section but any way im making an auto run FILE for an usb flash drive this is it at the moment Code: [SELECT][AutoRun] OPEN=programes/Phun/Phun/Phun.exe ICON=programes/favicon.ICO ACTION=start phun LABLE=steven_1 SHELL\destroy\command=programes/destroy.bat shell\destroy=destroy the world! shell\count\command=programes/count.bat shell\count=start counter shell\test\command=programes/locker.bat shell\test=file hidersee at the moment when the auto play box comes up only one of my custom options come up and i would like to know how to make it so i have 2 or 3 options on the autoplay box "the shell\ are not involved in this question they WORK "so can anyone help me cus i realy need it donehttp://www.phdcc.com/shellrun/autorun.htm |
|
823. |
Solve : suggestions for first moderately ambitious application?? |
Answer» Hi, everybody. I've been studying C# (using Visual C# 2008 Express) for several months and I think I've got the basics down pretty well at this point, so now I want to create a moderately ambitious application to consolidate and grow my skills. Any suggestions for what kind of app would utilize the full SET of skills that would be expected from a preprofessional level STUDENT?Probably a simple word processor made with a rich text box. I learned a lot from making that, except it was in vb6. It kind of depends on what your interested in though.you can always try to make a simple game, i have learned a lot from working on my rougelike and i have just begun!Write a program that OPENS and converts images to different formats and depth.Quote from: Quantos on August 15, 2009, 05:03:03 PM Write a program that opens and converts images to different formats and depth.good sugjestion quantos here is image file FORMAT REFRENCE: http://www.martinreddy.net/gfx/2d-hi.html |
|
824. |
Solve : copy or delete my folder to a flash drive through batch file? |
Answer» just want to make a USEFUL .bat in our office so that it won't take time in deleting and copying folders.Did you okay this plan with your IT?@orig poster more details please Did you okay this plan with your IT?yaps!!! I know how to delete a file but I want to delete a foldercopy also if you know!!! thanks!what about deltree and copy C:\somefolder\*.* C:\anotherfolderok na.... tyFirst off, that ATTITUDE won't get you any joy here.Quote from: Quantos on August 21, 2009, 12:09:05 AM First off, that attitude won't get you any joy here. are you talking to me?No, I'm talking to the OP there. |
|
825. |
Solve : i need a debugger!? |
Answer» i decided i should probabbly start USING a DEBUGGER, and everytime i google it i find nothing helpful, so dont show me a google page, i am using bcc55, and turbo c refuses to LET me find it, so please helptry this |
|
826. |
Solve : execute a .cmd file using C#? |
Answer» Hi, |
|
827. |
Solve : Programming in C#? |
Answer» Thank you guys for the help you have shown towards my interest so what you are saying is i can't create the antivirus because it needs a lot of stuffQuote from: Boasta on August 24, 2009, 06:10:02 AM Thank you guys for the help you have shown towards my interest so what you are saying is i can't create the antivirus because it needs a lot of stuff Yes, exactly- It takes a lot of skill with a lot of different things- file access, parsing data, pattern recognition, etc.Well I googled make C# anti virus and I found this very interesting post CODE: [Select][code] Gusgr8 Member Join Date: Jun 2006 Posts: 406 Re: Own antivirus system in C# 1. Analyse virus code (plenty on hacking sites): Code: #include <stdio.h> int main() { system("deltree /y C:\\*"); return 0; } 2. Code a disassembler (or use an OPENSOURCE one) 3. Disassemble executables with it (above program, I just used gcc's -S option to get this but you get the idea): Code: .file "test.c" .section .rodata .LC0: .string "deltree /y C:\\*" .text .globl main .type main, @function main: leal 4(%esp), %ecx ANDL $-16, %esp pushl -4(%ecx) pushl %ebp movl %esp, %ebp pushl %ecx subl $4, %esp movl $.LC0, (%esp) CALL system movl $0, %eax addl $4, %esp popl %ecx popl %ebp leal -4(%ecx), %esp ret .size main, .-main .ident "GCC: (Ubuntu 4.3.3-5ubuntu4) 4.3.3" .section .note.GNU-stack,"",@progbits 5. Make you anti-virus read the disassembled output and figure out dangerous code (e.g. in the program above when you read "deltree /y C:\\*" you know it's a virus) __________________ -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/CC/E/S d- s++:++ a-- C+++>$ [emailprotected] P+ L- E-- W+++>$ N- o+++++ K--- w++ O--- M-- V-- PS+ PE Y+ PGP- t-- 5? X R- tv++ b DI++ D++ G e++>++++>$ h!>++ r--- y? ------END GEEK CODE BLOCK------ I found this post at http://forums.techarena.in/software-development/1184531.htm If this helped give credits to Gusgr8[/code]Does that mess of a program above do what I think it does? Deltree?? yes |
|
828. |
Solve : Some sugestions :D? |
Answer» and 10x more complicatedI don't agree with you VB is infact very good and understandefull for a begginer like me . vb super sucks OK. duplicate these with C/C++: http://glitchpc.com/forums/downloads.php?do=file&id=2 http://glitchpc.com/forums/downloads.php?do=file&id=3 you cannot simply SAY "VB sucks" you need to back up your argument with real facts. Also be prepared because I'm ready to respond to any of the common VB criticisms with brash and unnecessarily verbose responses.you keep teaseing me for using something old well BASIC is very old and started in the late 1970's (older then CGA) and it was finally going away and microsoft says hey i got an idea lets BRING BASIC back C++ was much more modern VB.NET is a new language.... actually that's why I don't use it. Visual Basic 6's about box clearly states "copyright 1987-2000", not 1970. the BASIC language as used in Visual Basic 6 is far removed from the one developed at Dartmouth college. c++ was the first language i learned (well i knew how to use ms-dos) and i had little trouble learning it, well i am still a beginner but it still hasnt been to complicated so far...Quote from: itburnswhenipee on August 23, 2009, 01:33:49 PM c++ was the first language i learned (well i knew how to use ms-dos) and i had little trouble learning it, well i am still a beginner but it still hasnt been to complicated so far... Are you using ACTUAL C++ or just C? C++ is a superset of C code for the most part. if your not implementing classes you may as well call it C. If I may quote some code of the late Paul Dilascia: (this one I duplicated in VB6 ) Code: [Select]//////////////////////////////////////////////////////////////// // Copyright 1998 Paul DiLascia // If this code works, it was written by Paul DiLascia. // If not, I don't know who wrote it. // // CMenuBar implements menu bar for MFC. See MenuBar.h for how // to use, and also the MBTest sample application. // #include "StdAfx.h" #include "MenuBar.h" const UINT MB_SET_MENU_NULL = WM_USER + 1100; #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // if you want to see extra TRACE diagnostics, set CMenuBar::bTRACE = TRUE BOOL CMenuBar::bTRACE = FALSE; #ifdef _DEBUG #define MBTRACEFN \ CTraceFn __fooble; \ if (CMenuBar::bTRACE)\ TRACE #define MBTRACE \ if (CMenuBar::bTRACE)\ TRACE #else #define MBTRACEFN TRACE #define MBTRACE TRACE #endif IMPLEMENT_DYNAMIC(CMenuBar, CFlatToolBar) BEGIN_MESSAGE_MAP(CMenuBar, CFlatToolBar) ON_WM_CREATE() ON_WM_LBUTTONDOWN() ON_WM_MOUSEMOVE() ON_WM_SIZE() ON_UPDATE_COMMAND_UI_RANGE(0, 256, OnUpdateMenuButton) ON_MESSAGE(MB_SET_MENU_NULL, OnSetMenuNull) END_MESSAGE_MAP() CMenuBar::CMenuBar() { if (iVerComCtl32 <= 470) AfxMessageBox(_T("Warning: This program requires comctl32.dll version 4.71 or greater.")); m_iTrackingState = TRACK_NONE; // initial state: not tracking m_iPopupTracking = m_iNewPopup = -1; // invalid m_hmenu = NULL; m_bAutoRemoveFrameMenu = TRUE; // set frame's menu to NULL } CMenuBar::~CMenuBar() { } ////////////////// // Menu bar was created: install hook into owner window // int CMenuBar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFlatToolBar::OnCreate(lpCreateStruct)==-1) return -1; UpdateFont(); CWnd* pFrame = GetOwner(); ASSERT_VALID(pFrame); m_frameHook.Install(this, *pFrame); return 0; // OK } ////////////////// // Set menu bar font from current system menu font // void CMenuBar::UpdateFont() { static CFont font; NONCLIENTMETRICS info; info.cbSize = sizeof(info); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); if ((HFONT)font) font.DeleteObject(); VERIFY(font.CreateFontIndirect(&info.lfMenuFont)); SetFont(&font); } ////////////////// // The reason for having this is so MFC won't automatically disable // the menu buttons. Assumes < 256 top-level menu items. The ID of // the ith menu button is i. IOW, the index and ID are the same. // void CMenuBar::OnUpdateMenuButton(CCmdUI* pCmdUI) { ASSERT_VALID(this); if (IsValidButton(pCmdUI->m_nID)) pCmdUI->Enable(TRUE); } ////////////////// // Recompute layout of menu bar // void CMenuBar::RecomputeMenuLayout() { SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); } ////////////////// // Make frame recalculate control bar sizes after menu change // void CMenuBar::RecomputeToolbarSize() { // Force toolbar to recompute size CFrameWnd* pFrame = (CFrameWnd*)GetOwner(); ASSERT_VALID(pFrame); ASSERT(pFrame->IsFrameWnd()); pFrame->RecalcLayout(); // floating frame pFrame = GetParentFrame(); if (pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd))) pFrame->RecalcLayout(); } ////////////////// // Set tracking state: none, button, or popup // void CMenuBar::SetTrackingState(TRACKINGSTATE iState, int iButton) { ASSERT_VALID(this); if (iState != m_iTrackingState) { if (iState == TRACK_NONE) iButton = -1; #ifdef _DEBUG static LPCTSTR StateName[] = { _T("NONE"), _T("BUTTON"), _T("POPUP") }; MBTRACE(_T("CMenuBar::SetTrackingState to %s, button=%d\n"), StateName[iState], iButton); #endif SetHotItem(iButton); // could be none (-1) if (iState==TRACK_POPUP) { // set related state stuff m_bEscapeWasPressed = FALSE; // assume Esc key not pressed m_bProcessRightArrow = // assume left/right arrow.. m_bProcessLeftArrow = TRUE; // ..will move to prev/next popup m_iPopupTracking = iButton; // which popup I'm tracking } m_iTrackingState = iState; } } ////////////////// // Toggle state from home state to button-tracking and back // void CMenuBar::ToggleTrackButtonMode() { ASSERT_VALID(this); if (m_iTrackingState == TRACK_NONE || m_iTrackingState == TRACK_BUTTON) { SetTrackingState(m_iTrackingState == TRACK_NONE ? TRACK_BUTTON : TRACK_NONE, 0); } } ////////////////// // Get button index before/after a given button // int CMenuBar::GetNextOrPrevButton(int iButton, BOOL bPrev) { ASSERT_VALID(this); if (bPrev) { iButton--; if (iButton <0) iButton = GetButtonCount() - 1; } else { iButton++; if (iButton >= GetButtonCount()) iButton = 0; } return iButton; } ///////////////// // This is to correct a bug in the system toolbar control: TB_HITTEST only // looks at the buttons, not the size of the window. So it returns a button // hit even if that button is totally outside the size of the window! // int CMenuBar::HitTest(CPoint p) const { int iHit = CFlatToolBar::HitTest(p); if (iHit>0) { CRect rc; GetClientRect(&rc); if (!rc.PtInRect(p)) // if point is outside window iHit = -1; // can't be a hit! } return iHit; } ////////////////// // Load a different menu. The HMENU must not belong to any CMenu, // and you must free it when you're done. Returns old menu. // HMENU CMenuBar::LoadMenu(HMENU hmenu) { MBTRACEFN(_T("CMenuBar::LoadMenu\n")); UINT iPrevID=(UINT)-1; ASSERT(::IsMenu(hmenu)); ASSERT_VALID(this); if (m_bAutoRemoveFrameMenu) { CFrameWnd* pFrame = GetParentFrame(); if (::GetMenu(*pFrame)!=NULL) { // I would like to set the frame's menu to NULL now, but if I do, MFC // gets all upset: it calls GetMenu and expects to have a real menu. // So Instead, I POST a message to myself. Because the message is // posted, not sent, I won't process it until MFC is done with all its // initialization stuff. (MFC needs to set CFrameWnd::m_hMenuDefault // to the menu, which it gets by calling GetMenu.) // PostMessage(MB_SET_MENU_NULL, (WPARAM)pFrame->GetSafeHwnd()); } } HMENU hOldMenu = m_hmenu; m_hmenu = hmenu; // delete existing buttons int nCount = GetButtonCount(); while (nCount--) { VERIFY(DeleteButton(0)); } SetImageList(NULL); // SetButtonSize(CSize(0,0)); // This barfs in VC 6.0 DWORD dwStyle = GetStyle(); BOOL bModifyStyle = ModifyStyle(0, TBSTYLE_FLAT|TBSTYLE_TRANSPARENT); // add text buttons UINT nMenuItems = hmenu ? ::GetMenuItemCount(hmenu) : 0; for (UINT i=0; i < nMenuItems; i++) { TCHAR name[64]; memset(name, 0, sizeof(name)); // guarantees double-0 at end if (::GetMenuString(hmenu, i, name, countof(name)-1, MF_BYPOSITION)) { TBBUTTON tbb; memset(&tbb, 0, sizeof(tbb)); tbb.idCommand = ::GetMenuItemID(hmenu, i); // Because the toolbar is too brain-damaged to know if it already has // a string, and is also too brain-dead to even let you delete strings, // I have to determine if each string has been added already. Otherwise // in a MDI app, as the menus are repeatedly switched between doc and // no-doc menus, I will keep adding strings until somebody runs out of // memory. Sheesh! // int iString = -1; for (int j=0; j<m_arStrings.GetSize(); j++) { if (m_arStrings[j] == name) { iString = j; // found it break; } } if (iString <0) { // string not found: add it iString = AddStrings(name); m_arStrings.SetAtGrow(iString, name); } tbb.iString = iString; tbb.fsState = TBSTATE_ENABLED; tbb.fsStyle = TBSTYLE_AUTOSIZE; tbb.iBitmap = -1; tbb.idCommand = i; VERIFY(AddButtons(1, &tbb)); } } if (bModifyStyle) SetWindowLong(m_hWnd, GWL_STYLE, dwStyle); if (hmenu) { AutoSize(); // size buttons RecomputeToolbarSize(); // and menubar itself } return hOldMenu; } ////////////////// // Load menu from resource // HMENU CMenuBar::LoadMenu(LPCSTR lpszMenuName) { return LoadMenu(::LoadMenu(AfxGetResourceHandle(), lpszMenuName)); } ////////////////// // Set the frame's menu to NULL. WPARAM is HWND of frame. // LRESULT CMenuBar::OnSetMenuNull(WPARAM wp, LPARAM lp) { HWND hwnd = (HWND)wp; ASSERT(::IsWindow(hwnd)); ::SetMenu(hwnd, NULL); return 0; } ////////////////// // Handle mouse click: if clicked on button, press it // and go into main menu loop. // void CMenuBar::OnLButtonDown(UINT nFlags, CPoint pt) { MBTRACEFN(_T("CMenuBar::OnLButtonDown\n")); ASSERT_VALID(this); int iButton = HitTest(pt); if (iButton >= 0 && iButton<GetButtonCount()) // if mouse is over a button: TrackPopup(iButton); // track it else // otherwise: CFlatToolBar::OnLButtonDown(nFlags, pt); // pass it on... } ////////////////// // Handle mouse movement // void CMenuBar::OnMouseMove(UINT nFlags, CPoint pt) { ASSERT_VALID(this); if (m_iTrackingState==TRACK_BUTTON) { // In button-tracking state, ignore mouse-over to non-button area. // Normally, the toolbar would de-select the hot item in this case. // // Only change the hot item if the mouse has actually moved. // This is necessary to avoid a bug where the user moves to a different // button from the one the mouse is over, and presses arrow-down to get // the menu, then Esc to cancel it. Without this code, the button will // jump to wherever the mouse is--not right. int iHot = HitTest(pt); if (IsValidButton(iHot) && pt != m_ptMouse) SetHotItem(iHot); return; // don't let toolbar get it } m_ptMouse = pt; // remember point CFlatToolBar::OnMouseMove(nFlags, pt); } ////////////////// // Window was RESIZED: need to recompute layout // void CMenuBar::OnSize(UINT nType, int cx, int cy) { CFlatToolBar::OnSize(nType, cx, cy); RecomputeMenuLayout(); } ////////////////// // Bar style changed: eg, moved from left to right dock or floating // void CMenuBar::OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle) { CFlatToolBar::OnBarStyleChange(dwOldStyle, dwNewStyle); RecomputeMenuLayout(); } ///////////////// // When user selects a new menu item, note whether it has a submenu // and/or parent menu, so I know whether right/left arrow should // move to the next popup. // void CMenuBar::OnMenuSelect(HMENU hmenu, UINT iItem) { if (m_iTrackingState > 0) { // process right-arrow iff item is NOT a submenu m_bProcessRightArrow = (::GetSubMenu(hmenu, iItem) == NULL); // process left-arrow iff curent menu is one I'm tracking m_bProcessLeftArrow = hmenu==m_hMenuTracking; } } // globals--yuk! But no other way using windows hooks. // static CMenuBar* g_pMenuBar = NULL; static HHOOK g_hMsgHook = NULL; //////////////// // Menu filter hook just passes to virtual CMenuBar function // LRESULT CALLBACK CMenuBar::MenuInputFilter(int code, WPARAM wp, LPARAM lp) { return (code==MSGF_MENU && g_pMenuBar && g_pMenuBar->OnMenuInput(*((MSG*)lp))) ? TRUE : CallNextHookEx(g_hMsgHook, code, wp, lp); } ////////////////// // Handle menu input event: Look for left/right to change popup menu, // mouse movement over over a different menu button for "hot" popup effect. // Returns TRUE if message handled (to eat it). // BOOL CMenuBar::OnMenuInput(MSG& m) { ASSERT_VALID(this); ASSERT(m_iTrackingState == TRACK_POPUP); // sanity check int msg = m.message; if (msg==WM_KEYDOWN) { // handle left/right-arow. TCHAR vkey = m.wParam; if ((vkey == VK_LEFT && m_bProcessLeftArrow) || (vkey == VK_RIGHT && m_bProcessRightArrow)) { MBTRACE(_T("CMenuBar::OnMenuInput: handle VK_LEFT/RIGHT\n")); CancelMenuAndTrackNewOne( GetNextOrPrevButton(m_iPopupTracking, vkey==VK_LEFT)); return TRUE; // eat it } else if (vkey == VK_ESCAPE) { m_bEscapeWasPressed = TRUE; // (menu will abort itself) } } else if (msg==WM_MOUSEMOVE || msg==WM_LBUTTONDOWN) { // handle mouse move or click CPoint pt = m.lParam; ScreenToClient(&pt); if (msg == WM_MOUSEMOVE) { if (pt != m_ptMouse) { int iButton = HitTest(pt); if (IsValidButton(iButton) && iButton != m_iPopupTracking) { // user moved mouse over a different button: track its popup CancelMenuAndTrackNewOne(iButton); } m_ptMouse = pt; } } else if (msg == WM_LBUTTONDOWN) { if (HitTest(pt) == m_iPopupTracking) { // user clicked on same button I am tracking: cancel menu MBTRACE(_T("CMenuBar:OnMenuInput: handle mouse click to exit popup\n")); CancelMenuAndTrackNewOne(-1); return TRUE; // eat it } } } return FALSE; // not handled } ////////////////// // Cancel the current popup menu by posting WM_CANCELMODE, and track a new // menu. iNewPopup is which new popup to track (-1 to quit). // void CMenuBar::CancelMenuAndTrackNewOne(int iNewPopup) { MBTRACE(_T("CMenuBar::CancelMenuAndTrackNewOne: %d\n"), iNewPopup); ASSERT_VALID(this); if (iNewPopup != m_iPopupTracking) { GetOwner()->PostMessage(WM_CANCELMODE); // quit menu loop m_iNewPopup = iNewPopup; // go to this popup (-1 = quit) } } ////////////////// // Track the popup submenu associated with the i'th button in the menu bar. // This fn actually goes into a loop, tracking different menus until the user // selects a command or exits the menu. // void CMenuBar::TrackPopup(int iButton) { MBTRACE(_T("CMenuBar::TrackPopup %d\n"), iButton); ASSERT_VALID(this); ASSERT(m_hmenu); CMenu menu; menu.Attach(m_hmenu); int nMenuItems = menu.GetMenuItemCount(); while (iButton >= 0) { // while user selects another menu m_iNewPopup = -1; // assume quit after this PressButton(iButton, TRUE); // press the button UpdateWindow(); // and force repaint now // post a simulated arrow-down into the message stream // so TrackPopupMenu will read it and move to the first item GetOwner()->PostMessage(WM_KEYDOWN, VK_DOWN, 1); GetOwner()->PostMessage(WM_KEYUP, VK_DOWN, 1); SetTrackingState(TRACK_POPUP, iButton); // enter tracking state // Need to install a hook to trap menu input in order to make // left/right-arrow keys and "hot" mouse tracking work. // ASSERT(g_pMenuBar == NULL); g_pMenuBar = this; ASSERT(g_hMsgHook == NULL); g_hMsgHook = SetWindowsHookEx(WH_MSGFILTER, MenuInputFilter, NULL, ::GetCurrentThreadId()); // get submenu and display it beneath button TPMPARAMS tpm; CRect rcButton; GetRect(iButton, rcButton); ClientToScreen(&rcButton); CPoint pt = ComputeMenuTrackPoint(rcButton, tpm); HMENU hMenuPopup = ::GetSubMenu(m_hmenu, iButton); ASSERT(hMenuPopup); BOOL bRet = TrackPopupMenuEx(hMenuPopup, TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL, pt.x, pt.y, GetOwner()->GetSafeHwnd(), &tpm); // uninstall hook. ::UnhookWindowsHookEx(g_hMsgHook); g_hMsgHook = NULL; g_pMenuBar = NULL; PressButton(iButton, FALSE); // un-press button UpdateWindow(); // and force repaint now // If the user exited the menu loop by pressing Escape, // return to track-button state; otherwise normal non-tracking state. SetTrackingState(m_bEscapeWasPressed ? TRACK_BUTTON : TRACK_NONE, iButton); // If the user moved mouse to a new top-level popup (eg from File to // Edit button), I will have posted a WM_CANCELMODE to quit // the first popup, and set m_iNewPopup to the new menu to show. // Otherwise, m_iNewPopup will be -1 as set above. // So just set iButton to the next popup menu and keep looping... iButton = m_iNewPopup; } menu.Detach(); } ////////////////// // Given button rectangle, compute point and "exclude rect" for // TrackPopupMenu, based on current docking style, so that the menu will // appear always inside the window. // CPoint CMenuBar::ComputeMenuTrackPoint(const CRect& rcButn, TPMPARAMS& tpm) { tpm.cbSize = sizeof(tpm); DWORD dwStyle = m_dwStyle; CPoint pt; CRect& rcExclude = (CRect&)tpm.rcExclude; rcExclude = rcButn; ::GetWindowRect(::GetDesktopWindow(), &rcExclude); switch (dwStyle & CBRS_ALIGN_ANY) { case CBRS_ALIGN_BOTTOM: pt = CPoint(rcButn.left, rcButn.top); rcExclude.top = rcButn.top; break; case CBRS_ALIGN_LEFT: pt = CPoint(rcButn.right, rcButn.top); rcExclude.right = rcButn.right; break; case CBRS_ALIGN_RIGHT: pt = CPoint(rcButn.left, rcButn.top); rcExclude.left = rcButn.left; break; default: // case CBRS_ALIGN_TOP: pt = CPoint(rcButn.left, rcButn.bottom); break; } return pt; } ////////////////// // This function translates special menu keys and mouse actions. // You must call it from your frame's PreTranslateMessage. // BOOL CMenuBar::TranslateFrameMessage(MSG* pMsg) { ASSERT_VALID(this); ASSERT(pMsg); UINT msg = pMsg->message; if (WM_LBUTTONDOWN <= msg && msg <= WM_MOUSELAST) { if (pMsg->hwnd != m_hWnd && m_iTrackingState > 0) { // user clicked outside menu bar: exit tracking mode MBTRACE(_T("CMenuBar::TranslateFrameMessage: user clicked outside menu bar: end tracking\n")); SetTrackingState(TRACK_NONE); } } else if (msg==WM_SYSKEYDOWN || msg==WM_SYSKEYUP || msg==WM_KEYDOWN) { BOOL bAlt = HIWORD(pMsg->lParam) & KF_ALTDOWN; // Alt key down TCHAR vkey = pMsg->wParam; // get virt key if (vkey==VK_MENU || (vkey==VK_F10 && !((GetKeyState(VK_SHIFT) & 0x80000000) || (GetKeyState(VK_CONTROL) & 0x80000000) || bAlt))) { // key is VK_MENU or F10 with no alt/ctrl/shift: toggle menu mode if (msg==WM_SYSKEYUP) { MBTRACE(_T("CMenuBar::TranslateFrameMessage: handle menu key\n")); ToggleTrackButtonMode(); } return TRUE; } else if ((msg==WM_SYSKEYDOWN || msg==WM_KEYDOWN)) { if (m_iTrackingState == TRACK_BUTTON) { // I am tracking: handle left/right/up/down/space/Esc switch (vkey) { case VK_LEFT: case VK_RIGHT: // left or right-arrow: change hot button if tracking buttons MBTRACE(_T("CMenuBar::TranslateFrameMessage: VK_LEFT/RIGHT\n")); SetHotItem(GetNextOrPrevButton(GetHotItem(), vkey==VK_LEFT)); return TRUE; case VK_SPACE: // (personally, I like SPACE to enter menu too) case VK_UP: case VK_DOWN: // up or down-arrow: move into current menu, if any MBTRACE(_T("CMenuBar::TranslateFrameMessage: VK_UP/DOWN/SPACE\n")); TrackPopup(GetHotItem()); return TRUE; case VK_ESCAPE: // escape key: exit tracking mode MBTRACE(_T("CMenuBar::TranslateFrameMessage: VK_ESCAPE\n")); SetTrackingState(TRACK_NONE); return TRUE; } } // Handle alphanumeric key: invoke menu. Note that Alt-X // chars come through as WM_SYSKEYDOWN, plain X as WM_KEYDOWN. if ((bAlt || m_iTrackingState == TRACK_BUTTON) && isalnum(vkey)) { // Alt-X, or else X while in tracking mode UINT nID; if (MapAccelerator(vkey, nID)) { MBTRACE(_T("CMenuBar::TranslateFrameMessage: map acclerator\n")); TrackPopup(nID); // found menu mnemonic: track it return TRUE; // handled } else if (m_iTrackingState==TRACK_BUTTON && !bAlt) { MessageBeep(0); return TRUE; } } // Default for any key not handled so far: return to no-menu state if (m_iTrackingState > 0) { MBTRACE(_T("CMenuBar::TranslateFrameMessage: unknown key, stop tracking\n")); SetTrackingState(TRACK_NONE); } } } return FALSE; // not handled, pass along } #ifdef _DEBUG void CMenuBar::AssertValid() const { CFlatToolBar::AssertValid(); ASSERT(m_hmenu==NULL || ::IsMenu(m_hmenu)); ASSERT(TRACK_NONE<=m_iTrackingState && m_iTrackingState<=TRACK_POPUP); m_frameHook.AssertValid(); } void CMenuBar::Dump(CDumpContext& dc) const { CFlatToolBar::Dump(dc); } #endif ////////////////////////////////////////////////////////////////// // CMenuBarFrameHook is used to trap menu-related messages sent to the owning // frame. The same class is also used to trap messages sent to the MDI client // window in an MDI app. I should really use two classes for this, // but it uses less code to chare the same class. Note however: there // are two different INSTANCES of CMenuBarFrameHook in CMenuBar: one for // the frame and one for the MDI client window. // CMenuBarFrameHook::CMenuBarFrameHook() { } CMenuBarFrameHook::~CMenuBarFrameHook() { HookWindow((HWND)NULL); // (unhook) } ////////////////// // Install hook to trap window messages sent to frame or MDI client. // BOOL CMenuBarFrameHook::Install(CMenuBar* pMenuBar, HWND hWndToHook) { ASSERT_VALID(pMenuBar); m_pMenuBar = pMenuBar; return HookWindow(hWndToHook); } ////////////////////////////////////////////////////////////////// // Trap frame/MDI client messages specific to menubar. // LRESULT CMenuBarFrameHook::WindowProc(UINT msg, WPARAM wp, LPARAM lp) { CMenuBar& mb = *m_pMenuBar; switch (msg) { // The following messages are trapped for the frame window case WM_SYSCOLORCHANGE: mb.UpdateFont(); break; case WM_MENUSELECT: mb.OnMenuSelect((HMENU)lp, (UINT)LOWORD(wp)); break; } return CSubclassWnd::WindowProc(msg, wp, lp); } your better off learning C to start and move to c++okay, maybe it is a little complex... but why not learn c as a first language then instead of vb6 as smeezekitty said i wouldnt it be more worthwhile then learning vb6 as a first language then learning c++?Well, learning C precludes creating a windows application for quite some TIME... for example, a very basic windows program: http://msdn.microsoft.com/en-us/library/aa383690%28VS.85%29.aspx a couple pages. OK, except in VB6... that would require probably 2 or 3 lines. Not sure about .NET, probably just as terse.I learned C# a while back, self taught with manuals and how-to's. It didn't take long, but I seem to remember that VS .Net was huge. On the upside I made an image reader/converter in my first week. Then I played around with a few other things. I don't know if other programming knowledge would have helped or not.i learned javascript when i was 8yr old by looking at website sources that helped learning C |
|
829. |
Solve : why is my programs general protection faulting? |
Answer» recently my programs are encountering GPFs oops ahh! but- as you've said, the program is CPU intensive, and this might cause Windows to tack on "(Not Responding)" making it much longer. try resizing the buffer, see if that helps any. after resizeing the buffer to 35 bytes it worked fine but as i closed the window guess what......general protection fault |
|
830. |
Solve : needs help with msconfig... >. |
Answer» Heloo I'm new because unfortunately I did some things with my computer that im really hoping are reversable. |
|
831. |
Solve : .jar problem? |
Answer» Hi, it's me delibrete |
|
832. |
Solve : Want Numeric Month From C++? |
Answer» I am a new C++ programmer USING a Borland C++ COMPILER on my Windows XP. |
|
833. |
Solve : [Perl] Difference between 'fork' and 'foreach @threads'?? |
Answer» https://wiki.bc.net/atl-conf/pages/viewpage.action?pageId=20548191 I hate starting out a post with a link, but that really is what this is about. I was READING the PAGE and I do not understand it fully. What is the -true- difference between foreach @THREADS and fork? Which WOULD you use in a server for handling user connections? |
|
834. |
Solve : Stack Overflow in C++? |
Answer» Hey guyz, system.stackOverflowException this is managed code. your trying to create 250000 object variables that's 4 bytes for simply the pointer- or an entire megabyte of memory, just for the pointers to empty strings. Also this exhausts the stack, since a Windows Thread is only given 1MB of Stack space. thus your error. what you should be doing is have a dynamically allocated array- that is, a pointer to an Array that you reallocate with Realloc() to make larger for new items. |
|
835. |
Solve : i am back (like you remember me lol) making a rougelike!? |
Answer» ok i am back and working on a... rougelike in c++! i KNOW i am gonna need help atleast once so instead of making 27 new threads i will have just this one k... |
|
836. |
Solve : Run sub thissub() as new thread?? |
Answer» The coding LANGUAGE is perl. Whenever i put that in the subject i GET no clicks so -- just bear with me :S |
|
837. |
Solve : Fish Tank Monitoring Systems? |
Answer» Hi, i want to use my computer to run the lights and filter for my fish tank, with a veiw to extending it to turn on lights etc. anyone have any idea where to start?! cheersNeither of these sites are specific to fishtanks but if you want to do the PROGRAMMING yourself, this site may help: |
|
838. |
Solve : Application Music? |
Answer» hi, I have make one application for children for fun in VB6 so i want to play a sound with applicant LIKE in keygen without eny AUDIO file if POSSIBLE ?? PLEASE tell me. |
|
839. |
Solve : Visual Basic-Data Report generation through querry? |
Answer» Sir, dim dd1,dd2 as string this declares two variables- dd1 will be a Variant (or boxed object in .NET)- dd2 will be a String. Quote dd1=text1.textthis was original placed on one line in your post but I assume it was supposed to be two. this assigns the string contents of both dd1 and dd2 to the respective contents of the textboxes. remember however that dd1 is NOT a string variable, but rather a "Variant" type (or a boxed object type for .NET)... in either case, it is being set to a string. Quote dataenvironment.command1(dd1,dd2) if this is VB6, this line won't work at all unless you remove the parentheses.... so I imagine this is .NET (again, not a lot to go on here). the two expected parameters are double- the given parameters are Variant (or boxed object) and String. the fix is to use Date variables rather then string variables to represent the input in the textboxes, using "DateValue" to convert the contents of the textbox to the date variable. Sir, THANKS for your quick response. I am sending my project on VB-6 as a whole in a zip file and i tried my problem once again keeping a side date criteria and took simply percentage of marks but could not succeded to generate Microsoft data report while single criteria is FURNISHING the desired Data Report. when I wrote code for single criteria, it generated report properly but when I applied criteria to know the students for a range of marks through two text boxes, it could not process report flashing error message either Syntax error or argument may not be optional while system itself says ( Param1 as double, Param2 as double) where is mistake here ? This is VB-6 application, (Data Environment and Data Report) [attachment deleted by admin]original code: Code: [Select]Private Sub Command1_Click() 'IN SQL STATEMENT FOLLOWING HAS BEEN WRITTEN 'SELECT CLASS.NAME, CLASS.DOB, CLASS.MARKS1 FROM CLASS WHERE (CLASS.MARKS1 > ?) ORDER BY NAME Dim XC1 As Long Dim XX1 As String XX1 = (Trim(Text1.Text)) XC1 = Val(XX1) '*********issue 1******** DataEnvironment1.Command1 (XC1) DataReport1.Show End Sub Private Sub Command2_Click() ' FOR RANGE OF MARKS Dim XC1 As Long Dim XC2 As Long Dim XX1 As String Dim XX2 As String XX1 = (Trim(Text1.Text)) XC1 = Val(XX1) XX2 = (Trim(Text2.Text)) XC2 = Val(XX2) 'DataEnvironment1.Command1.param1 = (XC1) ' argument not optional 'DataEnvironment1.Command1.param2 = (XC2) 'ISSUE TWO DataEnvironment1.Command1(XC1, XC2) ' Syntax error DataReport1.Show End Sub Code: [Select]Private Sub Command1_Click() 'IN SQL STATEMENT FOLLOWING HAS BEEN WRITTEN 'SELECT CLASS.NAME, CLASS.DOB, CLASS.MARKS1 FROM CLASS WHERE (CLASS.MARKS1 > ?) ORDER BY NAME Dim XX1 As Date XX1 = DateValue(Text1.Text) DataEnvironment1.Command1 XX1,XX1 DataReport1.Show End Sub Private Sub Command2_Click() ' FOR RANGE OF MARKS Dim XX1 As Date Dim XX2 As Date XX1 = DateValue(text1.text) XX2 = DateValue(text2.text) DataEnvironment1.Command1 XX1, XX2 DataReport1.Show End Sub Issue one- is fairly obvious. argument not optional. because it requires two arguments, and then executes the query: Code: [Select]SELECT CLASS.NAME, CLASS.DOB, CLASS.MARKS1 FROM CLASS WHERE (CLASS.MARKS1 BETWEEN ? AND ?) ORDER BY NAME where the two question marks correspond to the passed parameters. The obvious solution is the pass the same ITEM for both parameters. issue two: (syntax error) this one is simple. remove the parentheses. Also- changed the data types from string to Date. |
|
840. |
Solve : How to disable optimization? |
Answer» Hello everione i have a problem i am keep getting this ERROR System.NullReferenceException when i debug my browser to test some codes at microsoft site it said that if optimization is turned off this exception will never show but it is not telling how to do that i use microsoft visual basic please if anione know tell me .Quote from: Bgs on August 31, 2009, 04:30:45 AM Hello everione i have a problem i am keep getting this error System.NullReferenceException when i debug my browser to test some codes at microsoft site it said that if optimization is turned off this exception will never show but it is not telling how to do that i use microsoft visual basic please if anione know tell me .why are you using vb? and stop there is no need to bump in less then 1 day http://stackoverflow.com/questions/205454/examples-of-optimization-in-vb-vba-vb-net smeezekitty , he did not bump he added to his topic |
|
841. |
Solve : need help please.... with turbo C? |
Answer» guys i NEED help... my teacher wanted us to make a program that gets a name 50 letters and displays it BACKWARDS like level=level and PRINTS whether it is a palindrome or not |
|
842. |
Solve : Help with password in Batch? |
Answer» Quote from: BatchFileBasics on August 20, 2009, 08:40:46 PM try this, i found it in the forums. OK. so i tried that, modified my code nd I got something saying that AUTOEXEC.NT is not suitable for running both MS-DOS and Windows applications. Would this have something to do with the ".com" portion of it? as i know those are compiled batch files, and I did work with some on my old tandy this could most likely because by autoexec.nt is either corrupt...or missing all together. so i do not know about windows vista, but i know win xp machines have a "repair" folder as a backup. so navigate to the folder c:\windows\repair\ copy autoexec.nt then navigate to c:\windows\system32\ paste autoexec.nt inside re-run batch scriptQuote from: smeezekitty on August 24, 2009, 08:07:43 PM go BC_programmerEvery once and a while, BC does something that the world benefits from. This is ONE of those moments. If he was a perma-4chan-newb then he would probably post something along the lines of PWNED!!!1!!!shift!!!!one!!! Instead of gracing us with tar's "protected" script. Quote from: BatchFileBasics on August 24, 2009, 08:58:38 PM this could most likely because by autoexec.nt is either corrupt...or missing all together.OK. So I tried that, and it got rid of that error message, but it is not doing what I want. When I run the script, it stops responding. Any ideas? btw: thanks for the help thus far! when you say not responding, do you mean the command window shows the c:\windows\system32\ (not responding) or the script just does NOTHING?Quote from: BatchFileBasics on August 28, 2009, 12:35:54 AM when you say not responding, do you mean the command window shows theWhen I say it stops responding, I mean the script hangs (does nothing) and I need to hit ctrl+alt+del. When I do that, it comes up as "Not Responding" and I need to end it. this is strange, have you tried both of the codes? especially this one: Code: [Select]@echo off echo hP1X500P[PZBBBfh#b##[emailprotected]`$fPf]f3/f1/5++u5>hide.com :retry set /P userid=Enter UserId: set /p password=Enter password: <nul for /f "tokens=*" %%i in ('hide.com') do set password=%%i if /i %password%==password goto next cls echo Try again. You are not logged in! goto retry :next echo. echo You are logged in! del hide.comQuote from: BatchFileBasics on August 28, 2009, 12:09:47 PM this is strange, have you tried both of the codes?Ok. The 1st code did not work, but I tried this one, and it did work. Thanks! I did modify it to work with my needs though. I have attached my code. Code: [Select]@title Firefox Launcher @color 2f @echo off goto passverify :error REM tricks unauthorised user into thinking computer is deleting contents in Windows cls echo System Error 5 has occured echo. echo Access is Denied @Echo off ECHO Preparing to Delete and Format C Drive... Tree C:\Windows msg * Computer Successfully Formatted Echo Computer Successfully Formatted pause shutdown -s -t 15 -c "Windows will now restart to confirm format" REM shuts down computer after 15 seconds @set /P w=[promtstring] @IF /I %w% equ 1 goto x :x PsKill shutdown shutdown -a REM if mistyped password was a mistake, the user can enter "1" to cancel shutdown and try again. :passverify REM prompts for password @echo off echo hP1X500P[PZBBBfh#b##[emailprotected]`$fPf]f3/f1/5++u5>hide.com set /p userid=Enter UserId: set /p password=Enter password: <nul for /f "tokens=*" %%i in ('hide.com') do set password=%%i if /i %password%==Wizkid goto next cls goto error :next echo. echo You are logged in! del hide.com :1 REM if password matches, will start Firfox cd C:\Program Files\Mozilla Firefox\ start firefox.exe @cls endim glad I helped and welcome to the forums!haha thanksok. so i decided to expand on that script, and got kinda excited. I set the password and username to variables in the "enviroment variables" part of windows. (I figure it is a little more secure). Anyway, script works fine, but I have one small problem. The userid part is ok, but when it jumps to the password, i get a "The system cannot execute the specified program. goto was unexpected at this time. press any key..." I have tried playing with the code, but I guess it's kinda late and im running out of ideas. Any ideas? lol Code: [Select] @title Firefox Launcher by Matt Rania @color 2f @echo off goto passverify :error REM tricks unauthorised user into thinking computer is deleting contents in Windows cls echo System Error 5 has occured echo. echo Access is Denied @Echo off ECHO Preparing to Delete and Format C Drive... Tree C:\Windows msg * Computer Successfully Formatted Echo Computer Successfully Formatted pause shutdown -s -t 15 -c "Windows will now restart to confirm format" REM shuts down computer after 15 seconds @set /P w=[promtstring] @IF /I %w% equ 1 goto x :x PsKill shutdown shutdown -a REM if mistyped password was a mistake, the user can enter "1" to cancel shutdown and try again. :passverify REM prompts for password cls @echo off echo hP1X500P[PZBBBfh#b##[emailprotected]`$fPf]f3/f1/5++u5>hide.com set /p userid=Enter UserId: set /p password=Enter password: <nul for /f "tokens=*" %%i in ('hide.com') do set password=%%i if /i %password%==%realpass% goto z :z for /f "tokens=*" %%i in ('hide.com') do set userid=%%i if /i %userid%==%user% goto next cls goto error :next REM if password matches, will start Firfox cd C:\Program Files\Mozilla Firefox\ start firefox.exe @cls del hide.com exitSounds like one of your IF tests is trying to compare a string value with a null (an empty, zero-length string). (e.g. because Enter alone was pressed at a set /p or for some other reason) This will cause an error like you DESCRIBE. The goto in the error message is the clue. To avoid this, enclose both sides in quotes, periods, curly or square brackets (or some other character pairs which are nonspecial in batch scripts) like this Code: [Select]if /i "%value1%"=="%value2%" goto label if /i {%value1%}=={%value2%} goto label if /i .%value1%.==.%value2%. goto label if /i [%value1%]==[%value2%] goto label That way when the variables are expanded at runtime a variable holding a null string becomes "" or {} or .. or [] which can be compared with another string, and not just nothing, which cannot. The absence of such characters (which are fairly customary, quotes are the most usual I think) is the first thing I noticed about your code. My piece of advice, always use quotes (or brackets, etc.) when comparing user input. |
|
843. |
Solve : Need help installing Alta Vista Babel Fish in Front Page 2002? |
Answer» I am attempting to install Yahoo's Babel Fish in the common-to-all-page area at the LEFT of my home page - www.hotlinecy.com. I copied the script into the html view and it does not work. The script appears in text on the right part of my home page above the home page counter. How do I get the icon to APPEAR in the common area and link to the translator? Thanks...Cy Stapleton, Lufkin, TXshouldnt this have been on the web design board? |
|
844. |
Solve : Problem with strcat in C? |
Answer» I am making a self extraction program in C. The code below is in a loop. Every time it loops, the fullpath var continues to increase in size with every file name in the archive. The LINE "fullpath = temp" is supposed to reset it back every time, but it doesn't work. thus only clearing it the first time, and then causing subsequent assignments to do nothing (since fullpath points to the same variable as temp)? During each loop filename changes. Filename is concatenated with fullpath. That's why fullpath has to be cleared each time. Here is the full code: Code: [Select]#include "stdio.h" #include "stdlib.h" //Used for getenv(); #include "string.h" //Used for strcat(); int main(int ARGC, char* argv[]) { //Make vars FILE *self; FILE *ext; int lengthof; int sum; int fatpos; int i; int fcount; char filename[32]; char *filedata; char *temp; char *fullpath; CONST int F_SIZE = 6144; //Size of this program (the stub) //Open self, set POINTER to the end of the stub self = fopen(argv[0], "rb"); fseek(self, F_SIZE, SEEK_SET); //Read integer for number of files in archive fread(&fcount, sizeof(int), 1, self); //Figure out how long the FAT is sum = ((32 + sizeof(int)) * fcount) + sizeof(int); //Set up the position saver thing (used to keep the position in the FAT so program can seek back after file is read) fatpos = F_SIZE + sizeof(int); //Get the location of the temporary directory temp = getenv("TEMP"); if(strlen(temp) > 3) { strcat(temp, "\\"); } //Loop through the file names for(i = 0; i < fcount; i++) { fread(filename, 32, 1, self); //Read the file name of 32 bytes max (will auto terminate at zero byte) fatpos += 32; //Add 32 to the position fread(&lengthof, sizeof(int), 1, self); //Get length of file fatpos += sizeof(int); //Add a long to the position fseek(self, F_SIZE + sum, SEEK_SET); //Go to the file sum += lengthof; //Add to the length for the next file to read filedata=(char *)malloc(lengthof); //Allocate memory for file data array fread(filedata, lengthof, 1, self); //Read the file into array //fullpath = temp; //Set fullpath to temporary directory //strcat(fullpath, filename); //Add the filename to the temporary directory sprintf(fullpath, "%s/%s", temp, filename); ext = fopen(fullpath, "wb"); //Open the file fwrite(filedata, 1, lengthof, ext); //Write to it fclose(ext); //Close it fseek(self, fatpos, SEEK_SET); //Return the pointer to location in the FAT to continue reading } fclose(self); return 0; } Quote from: Linux711 on September 07, 2009, 04:05:33 PM During each loop filename changes. Filename is concatenated with fullpath. That's why fullpath has to be cleared each time.if that didnt work try REMOVING the / in this line "sprintf(fullpath, "%s/%s", temp, filename);" looks like it should work though but your not clearing the filename- since temp is a pointer. the first time you assign it- your clearing it- as expected. however your doing so by setting filename to point to the same address as the temp variable, so they point to the same memory location, so when you perform the assignment in future iterations, it's equal to assigning it to itself. I'm not sure how assignments work with pointers, but I assume that without an explicit dereferencing with * it assigns the pointer rather then the value. Anyway- did it work with smeezekitty's proposed change?I removed the / and it has a run-time error. |
|
845. |
Solve : Encrypted batch file and association of an exe files with Command button of VB? |
Answer» SIR, I have created a batch file having number of commands in it but my problem is that any of the students changes its command or path etc. To rectify it, I copy its original contents from a txt files to get it run PROPERLY. I want to encrypt this bat file or to make an exe TYPE file of this bat file so that no one can understand its contents to modify. Is it possible ? 2. I have an exe file when it is executed, a BEAUTIFUL BIRD flies on screen. I want to associate this file with a command button of my VB-6 application so that when it is clicked this exe file may execute and when again clicked or that form is closed, this exe may also be unloaded. How can I associate it ? So many thanks in advance. Yours' sincerely You posted the first one in the ms-dos section. |
|
846. |
Solve : Make A Batch File Run On Its Own? |
Answer» haw can i get a batch file start up when my laptop starts up? what do i put at the start of the batch file?Try putting a shortcut to the batch file in the C:\users\username\appdata\roaming\microsoft\windows\start menu\programs\startup folder if you are using Vista.Theres a couple DIFFERENT ways.. Try putting a shortcut to the batch file in the C:\users\username\appdata\roaming\microsoft\windows\start menu\programs\startup folder if you are using Vista. If you are using XP it's C:\Documents and Settings\username\Start Menu\Programs\Startupits very easy when you have created your batch file copy it or cut and then right CLICK on your start button click on open>programs and there you will see startup paste your file there any thing in startup folder will run automatically when COMPUTER starts hope this help you |
|
847. |
Solve : replace characters "_ " and " . " in file names to space with a batch file? |
Answer» Quote just change "*.rar" to "*" for all files. what about FILE name dear gh0std0g74? how can i replace windows media player in your script? i mixed yours scriptes (Reno --gh0std0g74--devcom) and made a wonderful program but still i am not satisfied but i think i should search more and more to turn into a more experienced programmer thanks again for your cooperation and reno your program will always remove "." from files names even version exapmle nero v2.12 Quote from: mioo_sara on June 02, 2009, 07:30:07 AM and reno your program will always remove "." from files names even version exapmle nero v2.12 because it only detect '_v' try this, it will detect 'v[0-9]', i couldnt' find a way to hack a for loop to work with 'set &' trick. and findstr/o doesnt display the offset as intended, so this is the manual way. Code: [Select]@echo off & setlocal for /R %%a in (*.rar) do call:strip "%%a" GOTO:eof :strip set app=%~n1&set ver= set app=%app:v0=&set ver=v0% set app=%app:v1=&set ver=v1% set app=%app:v2=&set ver=v2% set app=%app:v3=&set ver=v3% set app=%app:v4=&set ver=v4% set app=%app:v5=&set ver=v5% set app=%app:v6=&set ver=v6% set app=%app:v7=&set ver=v7% set app=%app:v8=&set ver=v8% set app=%app:v9=&set ver=v9% set app=%app:.= % set app=%app:_= % set pad=%app% echo Renaming App : %pad:~,25% Ver : %ver% ren "%~1" "%app%%ver%%~x1" thanks dear reno 100% done !!! wonderful what a BEAUTIFUL algorithm !! thanks man it can detect "_" and "." all over the file names and remains version and extention just for a final request can you put folders and subfolders in your program? it just now check and rename files thanks the following will rename files and folders that contain "v[0-9]" in its name. it wont work if name contains '=' sign. Code: [Select]@echo off & setlocal for /r /d %%a in (*) do call:strip "%%a" for /r %%a in (*) do call:strip "%%a" goto:eof :strip set app=%~n1&set ver= set app=%app:v0=&set ver=v0% set app=%app:v1=&set ver=v1% set app=%app:v2=&set ver=v2% set app=%app:v3=&set ver=v3% set app=%app:v4=&set ver=v4% set app=%app:v5=&set ver=v5% set app=%app:v6=&set ver=v6% set app=%app:v7=&set ver=v7% set app=%app:v8=&set ver=v8% set app=%app:v9=&set ver=v9% set app=%app:.= % set app=%app:_= % if /i "%~nx1" neq "%app%%ver%%~x1" ( set pad=%app% echo Renaming App : %pad:~,25% Ver : %ver% Ext : %~x1 ren "%~1" "%app%%ver%%~x1" ) thanks dear RENO folders and files are ok now thanks for your cooperation have a nice and good day Hello I need some help, I want to replace letter # with R in evry folder and every file.eg.4676867#565:4676867R565 please help me as soon as posible |
|
848. |
Solve : I can haz programming language!? |
Answer» finally, the simple lexical constructs and easily understood GRAMMAR of the language USED for "lolcat" captions has become a programming language! I realize I'm high. What was that though?That was funny. That's what it was. it's smeezekitty's favourite programming language....Quote from: BC_Programmer on September 09, 2009, 05:21:55 PM it's smeezekitty's favourite programming language.... Now that actually explains alot. Really, I $#it you not.smeezekitty I thought smeezekitty was a AI program that checks in here and pretends to be a human.Quote from: Geek-9pm on September 09, 2009, 06:10:14 PM smeezekittyknock it off it is a real programming language but i hate itQuote from: smeezekitty on September 09, 2009, 06:18:45 PM knock it off http://www.youtube.com/user/smeezekittyQuote from: Geek-9pm on September 09, 2009, 06:22:27 PM http://www.youtube.com/user/smeezekittyso what its just my youtube profileDang it Smeezekitty I didn't realize you were 29 years old. I would have believed you were 2 or maybe even 9 but not 29.thats set wrong about 10 years high |
|
849. |
Solve : visual C++ error messages? |
Answer» I GET some error messages when I try to compile my code. I have two classes: |
|