473,890 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

baffling C# question

I have posted this before, but no one responds, so here
it goes again. I think my question is intimidating people
and I have no idea why?!? This is not a new concept. You
can do this with other programming languages, so why is
C# so different? Again, here is my baffling C# question.

I have C# code that opens an application, but right after
it opens I am confronted by prompts for information
(i.e. "Please enter your id"). I would like to handle
these prompts programmaticall y with C#. Is there some C#
code that passes a value to a prompt and then forces
the "ok" button?
Nov 15 '05 #1
12 1526
It can be done, but i wouldn't use C# for it.
From waht you are saying, you want to get the windowhandle of the dialog,
fill in text into a set of textboxes for hte prompt, and hit ok.
I know of no .NET classes that can do that nativly. You will have to go down
to the platform invoke level and call win32 functions directly.
Due to the amount of p\invoke, i'd advise using MC++ and asking in a Win32
group how exactly to do everything you need to. Such things are really
beyond the topic here. If you ahve done it before in C++ or delphi or VB6,
you should have a pretty good idea of what API's you want to call.
But by using MC++, you should be able to create an assembly that just
handles that lowerlevel stuff and can be called from C# where the bulk of
your work can still be done.
"Mike" <mi**@nospamher e.net> wrote in message
news:0c******** *************** *****@phx.gbl.. .
I have posted this before, but no one responds, so here
it goes again. I think my question is intimidating people
and I have no idea why?!? This is not a new concept. You
can do this with other programming languages, so why is
C# so different? Again, here is my baffling C# question.

I have C# code that opens an application, but right after
it opens I am confronted by prompts for information
(i.e. "Please enter your id"). I would like to handle
these prompts programmaticall y with C#. Is there some C#
code that passes a value to a prompt and then forces
the "ok" button?

Nov 15 '05 #2
> I have posted this before, but no one responds, so here
it goes again. I think my question is intimidating people
and I have no idea why?!? This is not a new concept. You
can do this with other programming languages, so why is
C# so different?
Would you be so kind and give us an example?
Again, here is my baffling C# question.
I have C# code that opens an application, but right after
it opens I am confronted by prompts for information
(i.e. "Please enter your id").
I would like to handle
these prompts programmaticall y with C#. Is there some C#
code that passes a value to a prompt and then forces
the "ok" button?

Nov 15 '05 #3
You should be able to send keystrokes uisng the
System.Windows. Forms.SendKeys class, it ought to be capable of doing most of
what you need.
--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_auth or_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_autho r_plug>
----------------------------------------------

"Mike" <mi**@nospamher e.net> wrote in message
news:0c******** *************** *****@phx.gbl.. .
I have posted this before, but no one responds, so here
it goes again. I think my question is intimidating people
and I have no idea why?!? This is not a new concept. You
can do this with other programming languages, so why is
C# so different? Again, here is my baffling C# question.

I have C# code that opens an application, but right after
it opens I am confronted by prompts for information
(i.e. "Please enter your id"). I would like to handle
these prompts programmaticall y with C#. Is there some C#
code that passes a value to a prompt and then forces
the "ok" button?

Nov 15 '05 #4
John,

I tried SendKeys and I was impressed. It's a bit too
unpredictable for me, but I think it's a step in the
right direction. At least you understand where I want to
take this thing.
-----Original Message-----
You should be able to send keystrokes uisng the
System.Windows .Forms.SendKeys class, it ought to be capable of doing most ofwhat you need.
--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_aut hor_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_autho r_plug>
----------------------------------------------

"Mike" <mi**@nospamher e.net> wrote in message
news:0c******* *************** ******@phx.gbl. ..
I have posted this before, but no one responds, so here
it goes again. I think my question is intimidating people and I have no idea why?!? This is not a new concept. You can do this with other programming languages, so why is
C# so different? Again, here is my baffling C# question.
I have C# code that opens an application, but right after it opens I am confronted by prompts for information
(i.e. "Please enter your id"). I would like to handle
these prompts programmaticall y with C#. Is there some C# code that passes a value to a prompt and then forces
the "ok" button?

.

Nov 15 '05 #5

"Mike" <mi**@nospamher e.net> wrote in message
news:0c******** *************** *****@phx.gbl.. .
I have posted this before, but no one responds, so here
it goes again. I think my question is intimidating people
and I have no idea why?!? This is not a new concept. You
can do this with other programming languages, so why is
C# so different? Again, here is my baffling C# question.

I have C# code that opens an application, but right after
it opens I am confronted by prompts for information
(i.e. "Please enter your id"). I would like to handle
these prompts programmaticall y with C#. Is there some C#
code that passes a value to a prompt and then forces
the "ok" button?


I have one simple question: Why can't you copy or modify the Access
report?

Perhaps there is a good reason, but it mystifies me. You seem to be making
a mountain of a project out of a molehill of a task.

Modifying the report is the obvious, simple, straightforward , virtually
trivial task. Parameter queries can usually be changed in minutes to
programatic control for providing these values. Using SendKeys, hooks,
window messages, etc. is the most roundabout way of tackling this problem.

I may be able to help you with either approach, but I don't want to waste
the effort of providing the right solution to the wrong problem.
Nov 15 '05 #6
Convince us you're not building some bu)(*&# hacker tool or password
spammer. I've seen several of your posts on this and you've answered
the questions as to why you want to do this.

Sorry to be so suspicious, but lately all my problems in coding have
been 100% because of hackers and the bullshit they cause in added
layers of extra crap security and such.

"Mike" <mi**@nospamher e.net> wrote in message news:<0c******* *************** ******@phx.gbl> ...
I have posted this before, but no one responds, so here
it goes again. I think my question is intimidating people
and I have no idea why?!? This is not a new concept. You
can do this with other programming languages, so why is
C# so different? Again, here is my baffling C# question.

I have C# code that opens an application, but right after
it opens I am confronted by prompts for information
(i.e. "Please enter your id"). I would like to handle
these prompts programmaticall y with C#. Is there some C#
code that passes a value to a prompt and then forces
the "ok" button?

Nov 15 '05 #7
I know VB6 had a nifty SendKeys("mysec retpassword{ent er}") function. This
function is available in C# by doing this:

System.Windows. Forms.SendKeys. Send("mysecretp assword{enter}" );

Chris LaJoie

"Mike" <mi**@nospamher e.net> wrote in message
news:00******** *************** *****@phx.gbl.. .
Excellent question. I'm building a solution to a years-
old company procedure, which is "set-in-stone" (for lack
of better terminology). This procedure is so ingrained,
and the Access application is so widely distributed, that
to change any part of the Access portion of it is a big
no-no. I agree, changing the Access Report would be a
simple solution. But since that is not an option, I have
to use C#...which is really not so bad, because I am
learning by leaps and bounds about C# and what it is
capable of.
-----Original Message-----

"Mike" <mi**@nospamher e.net> wrote in message
news:0c******* *************** ******@phx.gbl. ..
I have posted this before, but no one responds, so here
it goes again. I think my question is intimidating people and I have no idea why?!? This is not a new concept. You can do this with other programming languages, so why is
C# so different? Again, here is my baffling C# question.
I have C# code that opens an application, but right after it opens I am confronted by prompts for information
(i.e. "Please enter your id"). I would like to handle
these prompts programmaticall y with C#. Is there some C# code that passes a value to a prompt and then forces
the "ok" button?


I have one simple question: Why can't you copy or

modify the Access
report?

Perhaps there is a good reason, but it mystifies me.

You seem to be making
a mountain of a project out of a molehill of a task.

Modifying the report is the obvious, simple,

straightforward , virtually
trivial task. Parameter queries can usually be changed

in minutes to
programatic control for providing these values. Using

SendKeys, hooks,
window messages, etc. is the most roundabout way of

tackling this problem.

I may be able to help you with either approach, but I

don't want to waste
the effort of providing the right solution to the wrong

problem.


.

Nov 15 '05 #8
I have never heard of this problem before. Could you possibly try repeating
the SendKeys until it does work? I am aware of a couple APIs that might be
of some use. I'll do some research for you.

Chris LaJoie

"Mike" <mi**@nospamher e.net> wrote in message
news:03******** *************** *****@phx.gbl.. .
Chris,

I like your technique! It's almost exactly what I need! I
say "almost" because sendkeys is still very unreliable.
Sometimes it works, and sometimes it doesn't. When it
works, it works perfectly. When it doesn't work, the text
that is sent sometimes truncates. Sometimes it doesn't go
through at all.
-----Original Message-----
I know VB6 had a nifty SendKeys("mysec retpassword

{enter}") function. This
function is available in C# by doing this:

System.Windows .Forms.SendKeys .Send("mysecret password

{enter}");

Chris LaJoie

"Mike" <mi**@nospamher e.net> wrote in message
news:00******* *************** ******@phx.gbl. ..
Excellent question. I'm building a solution to a years-
old company procedure, which is "set-in-stone" (for lack of better terminology). This procedure is so ingrained,
and the Access application is so widely distributed, that to change any part of the Access portion of it is a big
no-no. I agree, changing the Access Report would be a
simple solution. But since that is not an option, I have to use C#...which is really not so bad, because I am
learning by leaps and bounds about C# and what it is
capable of.

>-----Original Message-----
>
>"Mike" <mi**@nospamher e.net> wrote in message
>news:0c******* *************** ******@phx.gbl. ..
>> I have posted this before, but no one responds, so here >> it goes again. I think my question is intimidating
people
>> and I have no idea why?!? This is not a new concept.
You
>> can do this with other programming languages, so why is >> C# so different? Again, here is my baffling C#
question.
>>
>> I have C# code that opens an application, but right
after
>> it opens I am confronted by prompts for information
>> (i.e. "Please enter your id"). I would like to handle >> these prompts programmaticall y with C#. Is there some C#
>> code that passes a value to a prompt and then forces
>> the "ok" button?
>
>I have one simple question: Why can't you copy or
modify the Access
>report?
>
>Perhaps there is a good reason, but it mystifies me.
You seem to be making
>a mountain of a project out of a molehill of a task.
>
>Modifying the report is the obvious, simple,
straightforward , virtually
>trivial task. Parameter queries can usually be changed in minutes to
>programatic control for providing these values. Using
SendKeys, hooks,
>window messages, etc. is the most roundabout way of
tackling this problem.
>
>I may be able to help you with either approach, but I
don't want to waste
>the effort of providing the right solution to the wrong problem.
>
>
>.
>

.

Nov 15 '05 #9
In looking into this I found out that most problems relating to SendKeys had
to do with the wrong window being in focus. If you ensure that your access
window (or whatever you're using) is the selected window, you should solve
all your problems. I found an alternative, the SendKeyboardSta te API in
user32.dll, which in my opinion looks like way more trouble than it's worth.
But if you want to research it, go for it! :)
good luck,

Chris LaJoie
Nov 15 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1961
by: Ben Floyd | last post by:
It goes like this: Im converting a perl script that executes a command on each result of a directory listing. In perl, all is well. In Python, using approximately the same logic creates a seemingly random problem I can't pin down. I hesitated to ask this question since it's so Slackware Linux-centric, and im new to Python. It's hard to ask in a generic way, but im out of options...
5
4600
by: TimS | last post by:
I am getting a baffling File not found error (0x800A0035). I am writing asp on a windows 2000 server. I build a path and filename from several fields in a jet database using SQL commands, like this: Sql = "SELECT dirs.rootname,dirs.dirname FROM dirs" RS.open Sql RS.movefirst do while not RS.EOF temp1=trim(RS("rootname"))
8
1984
by: Michelle | last post by:
I have tried every variation of the "onchange" statement below without any actual reloading of the page: The FireFox javaScript Console reports the following message: Error: missing : in conditional expression Source Code: location.href=themes.php?scheme=(form.color_schemes.options.value) My Code for the dropdown box is: <form name='color_schemes' method='post' action='themes.php' >
2
1822
by: bfrasca | last post by:
I have a well-formed XML file that I am trying to load into a dataset using the ReadXML method. It keeps telling me that "there are multiple root elements". I can view the data using XML Designer in Visual Studio 2003 without any problems and the schema and file have been validated using several different tools. I even successfully generated a typed dataset with Visual Studio 2003 by importing the XML into my project. I'm baffled, does...
3
3103
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table before rowID answID qryrow questionID datafield 1591 12 06e 06e 06e question 1593 12 06f 06f 06f question 1594 12 answer to the question 06f
2
1371
by: Double Echo | last post by:
Hi, Forgive me if I ask a dumb question, I'm new to classes and object programming with PHP, and cannot figure out what the problem is with this class. Maybe I have overlooked something but just can't see it. The error message usually means a typo or something that I missed. I get this error: Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in crypt_class.php on line 6
4
1069
by: CharlesA | last post by:
I'm using .net framework 1.1 C# and ASP.net with IE 6.0.2800 I'm using the very traditional idea of having a logo at the top left of the page which when clicked takes you to the home page This is the markup: <a id="logo" href="Entry.aspx"><img src="../images/logo.gif"></a> the trouble is, when I click it, it gets an unsightly purple border around the image which indicates that the image has been visited.
9
1282
by: djconner | last post by:
I'm a total neophyte in Javascript, trying to hack something together fast, and run into something that I can't understand at all. Two loops appear in sequence. The idea is that arrQuestions consists of the answers to each of 6 questions. Each is answered by a number, 0-5, and each number can only be used once. So arrNumbers tracks whether a particular number was used as an answer. arrNumbers would be set to 'Used' if the user...
1
1295
by: Tim Redfern | last post by:
Hi I'm having an issue that is probably obvious to somebody here but its baffling me.. I'm using python (2.5.1) on an embedded linux sytem system (kernel 2.6.19 I think) with only 32MB memory (for an art project). My python code runs nicely when launched manually from a login shell, ps shows its using 11MB or so of memory. However, when I try to launch the same code from a startup script, it
0
9976
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9814
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11214
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9616
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8006
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5834
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6034
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4659
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4257
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.